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
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
nohup)
if [ "" == "$pid" ]; then
if [ $pid ]; then
echo "starting BenBot in background (nohup)"
nohup php run.php > bot.out 2> bot.err < /dev/null &
else
@ -14,21 +15,22 @@ case "$1" in
;;
start)
if [ "" != "$pid" ]; then
if [ $pid ]; then
kill $pid
fi
php run.php
;;
stop)
if [ "" != "$pid" ]; then
if [ $pid ]; then
echo "killing BenBot ($pid)"
kill $pid
fi
;;
status)
if [ "" != "$pid" ]; then
#pgrep BenBot && echo "Running"
if [ $pid ]; then
echo "BenBot running with pid $pid"
else
echo "BenBot not running"
@ -36,7 +38,7 @@ case "$1" in
;;
log)
if [ "" != "$pid" ]; then
if [ $pid ]; then
less bot.out
else
echo "BenBot not running"
@ -49,7 +51,7 @@ case "$1" in
;;
restart)
if [ "" != "$pid" ]; then
if [ $pid ]; then
echo "killing BenBot ($pid)"
kill $pid
fi

File diff suppressed because it is too large Load Diff