bugs :D
This commit is contained in:
parent
9b80da1323
commit
543eab562e
25
cloudbot
25
cloudbot
|
@ -24,8 +24,7 @@ usage = "usage: ./cloudbot {start|stop|restart|status}"
|
|||
quit = "Goodbye! Thanks for using CloudBot!"
|
||||
|
||||
pwd = os.getcwd()
|
||||
clearlog1 = ": > ./bot.log && "
|
||||
clearlog2 = ": > ./bot.log"
|
||||
clearlog = ": > ./bot.log"
|
||||
|
||||
daemoncheck = subprocess.check_output("locate /usr/bin/daemon", shell=True)
|
||||
daemon = re.match(r'^/usr/bin/daemon$', daemoncheck)
|
||||
|
@ -59,16 +58,16 @@ pid = "echo 'Cannot get pid'"
|
|||
|
||||
if daemon:
|
||||
if backend == "daemon":
|
||||
start = "daemon -n cloudbot -O " + pwd + \
|
||||
start = "daemon -r -n cloudbot -O " + pwd + \
|
||||
"/bot.log python " + pwd + "/bot.py"
|
||||
stop = clearlog1 + "daemon -n cloudbot --stop"
|
||||
restart = clearlog1 + "daemon -n cloudbot --restart"
|
||||
stop = "daemon -n cloudbot --stop"
|
||||
restart = "daemon -n cloudbot --restart"
|
||||
pid = "pidof /usr/bin/daemon"
|
||||
elif backend == "screen":
|
||||
start = "screen -S cloudbot -dm python" + pwd +\
|
||||
"/bot.py >>" + pwd + "/bot.log 2>&1"
|
||||
stop = clearlog1 + "kill `pidof /usr/bin/screen`"
|
||||
restart = clearlog1 + "daemon -n cloudbot --restart"
|
||||
stop = "kill `pidof /usr/bin/screen`"
|
||||
restart = stop + " && " + start
|
||||
pid = "pidof /usr/bin/screen"
|
||||
elif backend == False:
|
||||
print "Welcome to your first run of: "
|
||||
|
@ -76,10 +75,10 @@ if daemon:
|
|||
print error5
|
||||
elif screen:
|
||||
if backend == "daemon":
|
||||
start = "daemon -n cloudbot -O " + pwd + \
|
||||
"/bot.log -r python " + pwd + "/bot.py"
|
||||
stop = clearlog1 + "daemon -n cloudbot --stop"
|
||||
restart = stop + " && " + start
|
||||
start = "daemon -r -n cloudbot -O " + pwd + \
|
||||
"/bot.log python " + pwd + "/bot.py"
|
||||
stop = "daemon -n cloudbot --stop"
|
||||
restart = "daemon -n cloudbot --restart"
|
||||
pid = "pidof /usr/bin/daemon"
|
||||
elif backend == "screen":
|
||||
start = "screen -S cloudbot -dm python" + pwd +\
|
||||
|
@ -123,7 +122,7 @@ try:
|
|||
command = pid
|
||||
print green + "Bot is running! " + nocol
|
||||
elif (sys.argv[1] == 'clear'):
|
||||
command = clearlog2
|
||||
command = clearlog
|
||||
else:
|
||||
command = command
|
||||
print usage
|
||||
|
@ -158,7 +157,7 @@ try:
|
|||
elif (sys.argv[1] == 'status'):
|
||||
print red + "Bot is not running!" + nocol
|
||||
elif (sys.argv[1] == 'clear'):
|
||||
command = clearlog2
|
||||
command = clearlog
|
||||
else:
|
||||
command = command
|
||||
print usage
|
||||
|
|
Reference in a new issue