From 8941d59dc20a837d904de208ee559d166c13a0e1 Mon Sep 17 00:00:00 2001 From: ChChBot admin Date: Fri, 24 Feb 2017 17:08:01 +0100 Subject: [PATCH 1/2] removed buggy part for killing old processes --- restartcloudbot.sh | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/restartcloudbot.sh b/restartcloudbot.sh index a2f7e1e..25f2324 100755 --- a/restartcloudbot.sh +++ b/restartcloudbot.sh @@ -2,18 +2,6 @@ cd $(dirname $0) ( -PIDS="" -for i in $(ps -awx | grep -i [c]loudbot | sed "s/^\s*//" | cut -d" " -f1); do - if [ $i != $$ ]; then - PIDS="$i $PIDS" - fi -done -if [ ! -z "$PIDS" ]; then - kill $PIDS - sleep 10 - kill -9 $PIDS >/dev/null 2>&1 -fi - while true do sudo -u cloudbot ./cloudbot.py 2>&1 | logger -s -t $(basename $0) From 21db4efd98e3708147697dabc76b0fa79eab6ba4 Mon Sep 17 00:00:00 2001 From: ChChBot admin Date: Fri, 24 Feb 2017 22:20:30 +0100 Subject: [PATCH 2/2] implemented lounge_light command --- plugins/chch_worker.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/chch_worker.py b/plugins/chch_worker.py index 65b85a8..86b67b0 100644 --- a/plugins/chch_worker.py +++ b/plugins/chch_worker.py @@ -61,10 +61,23 @@ def cmd_lamp_lounge(inp, reply=None): reply("fatal error") @hook.command("lounge_light_toggle", autohelp=False) -def cmd_ounge_light_toggle(inp, reply=None): +def cmd_lounge_light_toggle(inp, reply=None): """toggle lounge light modes""" reply(check_output("echo lounge_light_toggle | ssh -q -p 2322 command@127.0.0.1", shell=True).strip("\n").decode("utf-8")) - + +@hook.command("lounge_light", autohelp=False) +def cmd_lounge_light(inp, reply=None): + """set lounge light color""" + args = inp.split(" ") + if len(args) < 1: + reply("lounge_light color - set the light color") + return + + if len(args[0]) != 6: + reply("lounge_light color - set the light color") + return + + reply(check_output("echo lounge_light " + args[0] + " | ssh -q -p 2322 command@127.0.0.1", shell=True).strip("\n").decode("utf-8")) # Lamp handling @hook.command("lamp", autohelp=True)