oops, messed up a default. also fixed restart

This commit is contained in:
neersighted 2012-03-01 12:40:55 -08:00
parent e386b9999a
commit 55d2aa65bb
3 changed files with 8 additions and 9 deletions

View file

@ -46,13 +46,13 @@ pid = "echo 'Cannot get pid'"
daemonstart = "daemon -r -n cloudbot -O " + pwd + \ daemonstart = "daemon -r -n cloudbot -O " + pwd + \
"/bot.log python " + pwd + "/bot.py" "/bot.log python " + pwd + "/bot.py"
daemonstop = "daemon -n cloudbot --stop" daemonstop = "daemon -n cloudbot --stop"
daemonrestart = "daemon -n cloudbot --restart" daemonrestart = "./cloudbot stop > /dev/null 2>&1 && ./cloudbot start > /dev/null 2>&1"
daemonpid = "pidof /usr/bin/daemon" daemonpid = "pidof /usr/bin/daemon"
screenstart = "screen -d -m -S cloudbot -t cloudbot python " + pwd +\ screenstart = "screen -d -m -S cloudbot -t cloudbot python " + pwd +\
"/bot.py >> " + pwd + "/bot.log 2>&1" "/bot.py > " + pwd + "/bot.log 2>&1"
screenstop = "kill `pidof /usr/bin/screen`" screenstop = "kill `pidof /usr/bin/screen`"
screenrestart = stop + " && " + start screenrestart = "./cloudbot stop > /dev/null 2>&1 && ./cloudbot start > /dev/null 2>&1"
screenpid = "pidof /usr/bin/screen" screenpid = "pidof /usr/bin/screen"
# Checks # Checks
@ -93,6 +93,7 @@ if (backend == "daemon"):
pid = daemonpid pid = daemonpid
else: else:
print error5 print error5
exit
elif (backend == "screen"): elif (backend == "screen"):
if screen: if screen:
start = screenstart start = screenstart
@ -101,10 +102,12 @@ elif (backend == "screen"):
pid = screenpid pid = screenpid
else: else:
print error5 print error5
exit
elif (backend == False): elif (backend == False):
print firstrun print firstrun
else: else:
print error5 print error5
exit
# Fancy banner # Fancy banner
print " ______ __ ______ __ __ "\ print " ______ __ ______ __ __ "\

View file

@ -23,7 +23,7 @@ if not os.path.exists('config'):
"invitejoin": true, "invitejoin": true,
"autorejoin": false, "autorejoin": false,
"command_prefix": ".", "command_prefix": ".",
"stayalive": true, "stayalive": false,
"stayalive_delay": 20 "stayalive_delay": 20
} }
}, },

View file

@ -1,13 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
# Tiny little restarter by neersighted # Tiny little restarter by neersighted
import sys import sys
import os
import subprocess import subprocess
if os.path.isfile("./cloudbot"): restart = "./cloudbot restart"
restart = "./cloudbot restart"
else:
restart = "./bot.py"
subprocess.call(restart, shell=True) subprocess.call(restart, shell=True)
sys.exit() sys.exit()