Skip to content

Instantly share code, notes, and snippets.

@mariodian
Last active April 12, 2017 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariodian/b70d8753e23441abb2bead2bbcce93f1 to your computer and use it in GitHub Desktop.
Save mariodian/b70d8753e23441abb2bead2bbcce93f1 to your computer and use it in GitHub Desktop.
Handle OB server daemon
#!/bin/bash
ARGS="start -d -a 0.0.0.0"
cd /home/pi/source/OpenBazaar-Server
if [ "$1" = "start" ]; then
echo "OB Server starting..."
rm -rf /tmp/openbazaard.pid
python openbazaard.py $ARGS
elif [ "$1" = "stop" ]; then
echo "OB Server stopping..."
python openbazaard.py stop
elif [ "$1" = "restart" ]; then
PID="$(ps aux | grep -i openbazaar | grep -v grep | awk {'print $2'})"
echo "OB Server restarting..."
if [ $PID > 0 ]; then
kill -9 $PID
fi
rm -rf /tmp/openbazaard.pid
python openbazaard.py $ARGS
else
echo "No argument provided."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment