more fixes for first run
This commit is contained in:
parent
30fc42cd37
commit
739072bd39
1 changed files with 13 additions and 7 deletions
16
cloudbot
16
cloudbot
|
@ -5,10 +5,15 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
try:
|
|
||||||
|
if os.path.isfile("./config"):
|
||||||
|
command = command
|
||||||
|
try:
|
||||||
config = json.load(open('config'))
|
config = json.load(open('config'))
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
print 'error: malformed config', e
|
print 'error: malformed config', e
|
||||||
|
else:
|
||||||
|
config = False
|
||||||
|
|
||||||
nocol = "\033[1;m"
|
nocol = "\033[1;m"
|
||||||
red = "\033[1;31m"
|
red = "\033[1;31m"
|
||||||
|
@ -26,7 +31,10 @@ daemoncheck = subprocess.check_output("locate /usr/bin/daemon", shell=True)
|
||||||
daemon = re.match(r'^/usr/bin/daemon$', daemoncheck)
|
daemon = re.match(r'^/usr/bin/daemon$', daemoncheck)
|
||||||
screencheck = subprocess.check_output("locate /usr/bin/screen", shell=True)
|
screencheck = subprocess.check_output("locate /usr/bin/screen", shell=True)
|
||||||
screen = re.match(r'^/usr/bin/screen$', screencheck)
|
screen = re.match(r'^/usr/bin/screen$', screencheck)
|
||||||
backend = config.get("wrapper", {}).get("backend", "daemon")
|
if os.path.isfile("./config"):
|
||||||
|
backend = config.get("wrapper", {}).get("backend", "daemon")
|
||||||
|
else
|
||||||
|
backend = daemon
|
||||||
|
|
||||||
try:
|
try:
|
||||||
runningcheck = subprocess.check_output("ps ax|grep cloudbot|"\
|
runningcheck = subprocess.check_output("ps ax|grep cloudbot|"\
|
||||||
|
@ -175,8 +183,6 @@ except (KeyboardInterrupt), e:
|
||||||
except (NameError, SyntaxError), e:
|
except (NameError, SyntaxError), e:
|
||||||
print error6
|
print error6
|
||||||
exit
|
exit
|
||||||
except (IOError), e:
|
|
||||||
pass
|
|
||||||
if os.path.isfile("./bot.py"):
|
if os.path.isfile("./bot.py"):
|
||||||
command = command
|
command = command
|
||||||
else:
|
else:
|
||||||
|
|
Reference in a new issue