Last active
April 12, 2017 04:57
-
-
Save mariodian/b70d8753e23441abb2bead2bbcce93f1 to your computer and use it in GitHub Desktop.
Handle OB server daemon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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