Archived
1
0
Fork 0
This repository has been archived on 2021-10-08. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
ACU/commands/project/send_trace.sh
2013-10-18 09:13:13 +02:00

50 lines
916 B
Bash

#!/bin/sh
if [ "$#" -ne 3 ]
then
echo "Usage: $0 project rendu [login] file"
exit 1
fi
project_id="$1"
rendu="$2"
if [ -z "$4" ]
then
login=`basename $3`
login="${login%%.xml}"
file="$3"
else
login="$3"
file="$4"
fi
if ! whereis gearman > /dev/null 2> /dev/null
then
echo "gearman isn't installed on this machine. Please try another one."
exit 1
fi
if ! [ -f "$file" ]; then
echo "$file: File not found"
exit 2
fi
if [ -z "$login" ]
then
FILENAME=$(basename "$file")
else
FILENAME="$login.xml"
fi
FILE="<file name=\"$FILENAME\">$(base64 $file)</file>"
cat <<EOF | gearman -h gearmand -p 4730 -f intradata_get
<?xml version="1.0" encoding="UTF-8"?>
<process>
<param name="type">trace</param>
<param name="id">$project_id</param>
<param name="year">2016</param>
<param name="rendu">$rendu</param>
<param name="login">$login</param>
$FILE
</process>
EOF