#!/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="$(base64 $file)"
cat <
trace
$project_id
2016
$rendu
$login
$FILE
EOF