From 1be43d9e51e4b36a826a86035dc064963ea7d23b Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Tue, 2 Jul 2013 03:52:11 +1200 Subject: [PATCH] Uploaded the old launcher to the disabled_stuff folder, because some people still want it --- .../antiflood.py | 0 disabled_stuff/cloudbot.sh | 126 ++++++++++++++++++ {disabled_plugins => disabled_stuff}/mtg.py | 0 .../mygengo_translate.py | 0 .../repaste.py | 0 .../suggest.py | 0 .../urlhistory.py | 0 .../wordoftheday.py | 0 .../wrapper.old | 0 9 files changed, 126 insertions(+) rename {disabled_plugins => disabled_stuff}/antiflood.py (100%) create mode 100644 disabled_stuff/cloudbot.sh rename {disabled_plugins => disabled_stuff}/mtg.py (100%) rename {disabled_plugins => disabled_stuff}/mygengo_translate.py (100%) rename {disabled_plugins => disabled_stuff}/repaste.py (100%) rename {disabled_plugins => disabled_stuff}/suggest.py (100%) rename {disabled_plugins => disabled_stuff}/urlhistory.py (100%) rename {disabled_plugins => disabled_stuff}/wordoftheday.py (100%) rename {disabled_plugins => disabled_stuff}/wrapper.old (100%) diff --git a/disabled_plugins/antiflood.py b/disabled_stuff/antiflood.py similarity index 100% rename from disabled_plugins/antiflood.py rename to disabled_stuff/antiflood.py diff --git a/disabled_stuff/cloudbot.sh b/disabled_stuff/cloudbot.sh new file mode 100644 index 0000000..877c4ea --- /dev/null +++ b/disabled_stuff/cloudbot.sh @@ -0,0 +1,126 @@ +#!/bin/bash +echo "" +echo " ________ ______ __ " +echo " / ____/ /___ __ ______/ / __ )____ / /_" +echo " / / / / __ \/ / / / __ / __ / __ \/ __/" +echo "/ /___/ / /_/ / /_/ / /_/ / /_/ / /_/ / /_ " +echo "\____/_/\____/\__,_/\__,_/_____/\____/\__/ " +echo " http://git.io/cloudbotirc by ClouDev " +echo "" +locatefiles() { + botfile="/bot.py" + botfile=$(pwd)$botfile + logfile="/bot.log" + logfile=$(pwd)$logfile +} + +running() { + if [[ $(ps aux|grep bot.py|grep -v grep|grep -v daemon|grep -v SCREEN) != "" ]]; then + true + else + false + fi +} + +checkbackend() { + if dpkg -l| grep ^ii|grep daemon|grep 'turns other' > /dev/null; then + backend="daemon" + elif dpkg -l| grep ^ii|grep screen|grep 'terminal multi' > /dev/null; then + backend="screen" + else + backend="manual" + fi + return 0 +} + +setcommands() { + status() { + if running; then + echo "CloudBot is running!" + else + echo "CloudBot is not running!" + fi + } + clear() { + : > $logfile + } + if [ "$backend" == "daemon" ]; then + start() { + daemon -r -n cloudbot -O $logfile python $botfile + } + stop() { + daemon -n cloudbot --stop + } + elif [ "$backend" == "screen" ]; then + start() { + screen -d -m -S cloudbot -t cloudbot python $botfile > $logfile 2>&1 + } + stop() { + pid=`ps ax|grep -v grep|grep python|grep -v SCREEN|grep $botfile|awk '{print $1}'` + kill $pid + } + elif [ "$backend" == "manual" ]; then + start() { + $botfile + } + stop() { + pid=`ps ax|grep -v grep|grep python|grep $botfile|awk '{print $1}'` + kill $pid + } + fi +} + +processargs() { + case $1 in + start|-start|--start) + if running; then + echo "Cannot start! Bot is already running!" + exit 1 + else + echo "Starting CloudBot... ($backend)" + start + fi + ;; + stop|-stop|--stop) + if running; then + echo "Stopping CloudBot... ($backend)" + stop + else + echo "Cannot stop! Bot is not already running!" + exit 1 + fi + ;; + restart|-restart|--restart) + if running; then + echo "Restarting CloudBot... ($backend)" + stop + sleep 3 + start + else + echo "Cannot restart! Bot is not already running!" + exit 1 + fi + ;; + clear|-clear|--clear) + echo "Clearing logs..." + clear + ;; + status|-status|--status) + status + ;; + *) + usage="usage: ./cloudbot {start|stop|restart|clear|status}" + echo $usage + ;; + esac +} + +main() { + locatefiles + checkbackend + setcommands + processargs $1 +} + +main $* +exit 0 \ No newline at end of file diff --git a/disabled_plugins/mtg.py b/disabled_stuff/mtg.py similarity index 100% rename from disabled_plugins/mtg.py rename to disabled_stuff/mtg.py diff --git a/disabled_plugins/mygengo_translate.py b/disabled_stuff/mygengo_translate.py similarity index 100% rename from disabled_plugins/mygengo_translate.py rename to disabled_stuff/mygengo_translate.py diff --git a/disabled_plugins/repaste.py b/disabled_stuff/repaste.py similarity index 100% rename from disabled_plugins/repaste.py rename to disabled_stuff/repaste.py diff --git a/disabled_plugins/suggest.py b/disabled_stuff/suggest.py similarity index 100% rename from disabled_plugins/suggest.py rename to disabled_stuff/suggest.py diff --git a/disabled_plugins/urlhistory.py b/disabled_stuff/urlhistory.py similarity index 100% rename from disabled_plugins/urlhistory.py rename to disabled_stuff/urlhistory.py diff --git a/disabled_plugins/wordoftheday.py b/disabled_stuff/wordoftheday.py similarity index 100% rename from disabled_plugins/wordoftheday.py rename to disabled_stuff/wordoftheday.py diff --git a/disabled_plugins/wrapper.old b/disabled_stuff/wrapper.old similarity index 100% rename from disabled_plugins/wrapper.old rename to disabled_stuff/wrapper.old