switched restarter to python
This commit is contained in:
parent
efecefbf19
commit
c014d91ec2
3 changed files with 16 additions and 14 deletions
13
lib/restart.py
Executable file
13
lib/restart.py
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# Tiny little restarter by neersighted
|
||||||
|
import subprocess, sys, os
|
||||||
|
|
||||||
|
if os.path.isfile("./control.sh"):
|
||||||
|
restart = "./control.sh restart"
|
||||||
|
elif os.path.isfile("./bot.sh"):
|
||||||
|
restart = "./bot.sh restart"
|
||||||
|
else:
|
||||||
|
restart = "./bot.py"
|
||||||
|
|
||||||
|
subprocess.call(restart, shell=True)
|
||||||
|
sys.exit()
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
sleep 5
|
|
||||||
if [ -f ./control.sh ]; then
|
|
||||||
./control.sh restart
|
|
||||||
elif [ -f ./bot.sh ]; then
|
|
||||||
./bot.sh restart
|
|
||||||
else
|
|
||||||
./bot.py
|
|
||||||
fi
|
|
||||||
exit 0
|
|
|
@ -1,10 +1,9 @@
|
||||||
# Shitty plugin made by iloveportalz0r
|
# Shitty plugin made by iloveportalz0r
|
||||||
# Broken by The Noodle
|
# Broken by The Noodle
|
||||||
# Improved by Lukeroge
|
# Improved by Lukeroge
|
||||||
|
# Further improved by neersighted
|
||||||
from util import hook
|
from util import hook
|
||||||
import sys
|
import sys, subprocess, time
|
||||||
import subprocess
|
|
||||||
import time
|
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def quit(inp, input=None, db=None, notice=None):
|
def quit(inp, input=None, db=None, notice=None):
|
||||||
|
@ -30,7 +29,7 @@ def restart(inp, input=None, db=None, notice=None):
|
||||||
else:
|
else:
|
||||||
input.conn.send("QUIT :Bot restarted by "+input.nick+" (no reason)")
|
input.conn.send("QUIT :Bot restarted by "+input.nick+" (no reason)")
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
subprocess.call(['lib/restart.sh'])
|
subprocess.call(['lib/restart.py'])
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
|
|
Reference in a new issue