50 lines
916 B
Bash
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
|