Last active
July 21, 2016 22:17
-
-
Save adispen/8026f0ea83e3c02d260406dbaa08f9b9 to your computer and use it in GitHub Desktop.
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 | |
echo "Starting" | |
lockfile=/home/adispen/PokemonGo-Map-dev/lock/map.lock | |
function runMap { | |
pwd | |
python runserver.py -a -u -p -l "" -st 5 -H 0.0.0.0 -P 9001 &> /home/adispen/PokemonGo-Map-dev/logs/map1.log & | |
python runserver.py -a -u -p -l "" -st 5 -H 0.0.0.0 -P 9002 &> /home/adispen/PokemonGo-Map-dev/logs/map2.log & | |
} | |
if (set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null; then | |
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT | |
cd /home/adispen/PokemonGo-Map-dev | |
source venv/bin/activate | |
runMap | |
sleep infinity | |
deactivate | |
rm -f "$lockfile" | |
trap - INT TERM EXIT | |
else | |
echo "Lock Exists: $lockfile owned by $(cat $lockfile)" | |
lockID=$(<$lockfile) | |
kill -- -$lockID | |
sleep 1 | |
exec /home/adispen/launchmap.sh | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment