fix jokes file and bot

This commit is contained in:
Ben Harris 2017-04-13 02:16:15 -04:00
parent f09dba2c08
commit 54e084a952
2 changed files with 104 additions and 1892 deletions

16
bot Executable file → Normal file
View File

@ -1,11 +1,12 @@
#!/bin/bash #!/bin/bash
pid=$(ps -ef | grep BenBot | grep -v grep | awk '{print $2}') # pid=$(ps -ef | grep BenBot | grep -v grep | awk '{print $2}')
pid=$(pidof BenBot)
case "$1" in case "$1" in
nohup) nohup)
if [ "" == "$pid" ]; then if [ $pid ]; then
echo "starting BenBot in background (nohup)" echo "starting BenBot in background (nohup)"
nohup php run.php > bot.out 2> bot.err < /dev/null & nohup php run.php > bot.out 2> bot.err < /dev/null &
else else
@ -14,21 +15,22 @@ case "$1" in
;; ;;
start) start)
if [ "" != "$pid" ]; then if [ $pid ]; then
kill $pid kill $pid
fi fi
php run.php php run.php
;; ;;
stop) stop)
if [ "" != "$pid" ]; then if [ $pid ]; then
echo "killing BenBot ($pid)" echo "killing BenBot ($pid)"
kill $pid kill $pid
fi fi
;; ;;
status) status)
if [ "" != "$pid" ]; then #pgrep BenBot && echo "Running"
if [ $pid ]; then
echo "BenBot running with pid $pid" echo "BenBot running with pid $pid"
else else
echo "BenBot not running" echo "BenBot not running"
@ -36,7 +38,7 @@ case "$1" in
;; ;;
log) log)
if [ "" != "$pid" ]; then if [ $pid ]; then
less bot.out less bot.out
else else
echo "BenBot not running" echo "BenBot not running"
@ -49,7 +51,7 @@ case "$1" in
;; ;;
restart) restart)
if [ "" != "$pid" ]; then if [ $pid ]; then
echo "killing BenBot ($pid)" echo "killing BenBot ($pid)"
kill $pid kill $pid
fi fi

File diff suppressed because it is too large Load Diff