Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 50 lines (34 sloc) 1.31 KB
#!/bin/sh
PID=`cat .pid`
UNIX_BENCH_VERSION='5.1.3'
UNIX_BENCH_DIR=UnixBench-$UNIX_BENCH_VERSION
UPLOAD_ENDPOINT='http://couponmancer.com/uploads.text'
#UPLOAD_ENDPOINT='http://dev.couponmancer.com:3000/uploads.text'
if [ -e "`pwd`/.pid" ] && ps -p $PID >&- ; then
echo "Serverzor job is already running (PID: $PID)"
exit 0
fi
cat > run-upload.sh << EOF
#!/bin/sh
rm -rf UnixBench
if ! [ -e "`pwd`/$UNIX_BENCH_DIR" ]; then
echo "Getting UnixBench $UNIX_BENCH_VERSION..."
curl -s https://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz | tar -xz
mv UnixBench $UNIX_BENCH_DIR
fi
echo "Running UnixBench as a background task."
echo "This can take several hours. Serverzor will email you when it's done."
echo "You can log out/Ctrl-C any time while this is happening (it's running through nohup)."
cd $UNIX_BENCH_DIR
./Run > sz-output.log 2> sz-error.log
RESPONSE=\`curl -s -F "upload[upload_type]=unix-bench-output" -F "upload[data]=<sz-output.log" -F "upload[key]=$SZ_KEY" $UPLOAD_ENDPOINT\`
RESPONSE=\`curl -s -F "upload[upload_type]=unix-bench-error" -F "upload[data]=<sz-error.log" -F "upload[key]=$SZ_KEY" $UPLOAD_ENDPOINT\`
echo "Uploading results..."
echo "Response: \$RESPONSE"
echo "Done"
exit 0
EOF
chmod u+x run-upload.sh
nohup ./run-upload.sh > sz-script.log &
echo $! > .pid
tail -f sz-script.log