New process to send a trace to Intranet
This commit is contained in:
parent
37db6f3256
commit
51257dd34b
1 changed files with 50 additions and 0 deletions
50
commands/project/send_trace.sh
Normal file
50
commands/project/send_trace.sh
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/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
|
Reference in a new issue