Created
September 26, 2011 13:45
-
-
Save coffeejunk/1242263 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
unset GIT_DIR | |
cd .. | |
git reset HEAD --hard | |
# kill the scheduler if running | |
pid=$(ps a | grep 'sched.rb' | grep -v 'grep' | cut -d ' ' -f 1) | |
if [ ! -z "$pid" ]; then | |
# scheduler script running | |
kill $pid | |
fi | |
# if no screen session exists create one. | |
if [ -z "$(screen -ls | grep 'rb-sched')" ]; then | |
screen -dmS rb-sched | |
# have to wait a bit otherwise the command will not be executed | |
sleep 1 | |
fi | |
# restart scheduler in screen session | |
screen -S rb-sched -X stuff "ruby sched.rb `echo '\015'`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment