44 lines
1.5 KiB
Python
Executable file
44 lines
1.5 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# Bot Wrapper by neersighted
|
|
import sys
|
|
import os
|
|
import subprocess
|
|
|
|
pwd = os.getcwd()
|
|
clearlog = ": >./bot.log && "
|
|
start = "daemon -n cloudbot -O " + pwd + "/bot.log -r python " + pwd + "/bot.py"
|
|
stop = clearlog + "daemon -n cloudbot --stop"
|
|
restart = clearlog + "daemon -n cloudbot --restart"
|
|
command = ":"
|
|
|
|
print " ______ __ ______ __ __ _______ .______ ______ .___________."
|
|
print " / || | / __ \ | | | | | \ | _ \ / __ \ | |"
|
|
print "| ,----'| | | | | | | | | | | .--. || |_) | | | | | `---| |----`"
|
|
print "| | | | | | | | | | | | | | | || _ < | | | | | | "
|
|
print "| `----.| `----.| `--' | | `--' | | '--' || |_) | | `--' | | | "
|
|
print " \______||_______| \______/ \______/ |_______/ |______/ \______/ |__| "
|
|
print "http://git.io/cloudbot by lukeroge"
|
|
|
|
if (len(sys.argv) > 1):
|
|
if( sys.argv[1] == 'start' ):
|
|
command = start
|
|
elif( sys.argv[1] == 'stop' ):
|
|
command = stop
|
|
elif( sys.argv[1] == 'restart' ):
|
|
command = restart
|
|
else:
|
|
print "usage: ./cloudbot {start|stop|restart}"
|
|
sys.exit()
|
|
else:
|
|
print "usage: ./cloudbot {start|stop|restart}"
|
|
sys.exit()
|
|
|
|
if os.path.isfile("./bot.py"):
|
|
command = command
|
|
else:
|
|
print "Could not find bot.py! Are you in the wrong folder? (" + pwd + ")"
|
|
sys.exit()
|
|
|
|
subprocess.call(command, shell=True)
|
|
sys.exit()
|