59 lines
1.3 KiB
Bash
Executable file
59 lines
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
startDate=`date "+%Y%m%d%H%M%S"`;
|
|
|
|
. inc/sh/inc.bot.sh
|
|
|
|
bot_root=`pwd`
|
|
bot_pid=${bot_root}/log/tmp/pandabot.pid
|
|
madeline_session=${bot_root}/session.madeline
|
|
madeline_pid=`ps -ef | grep ${madeline_session} | grep -v grep | awk '{print $2}'`
|
|
apache_pid=${bot_root}/log/tmp/httpd.pid
|
|
fpm_pid=${bot_root}/log/tmp/php-fpm.pid
|
|
|
|
pandabotconf=${bot_root}/conf/pandabot.conf
|
|
services="bot|web|apache|fpm|madeline|";
|
|
|
|
waittimer=`getpandabotconf "${pandabotconf}" "botsh_restart_wait_timer"`
|
|
[ $? -ne 0 ] && echo "ERR: botsh_restart_wait_timer not configured @ ${pandabotconf}" && exit 1
|
|
|
|
[ $# -eq 0 ] && bot_sh_usage && exit 1
|
|
|
|
OPTIND=2;
|
|
while getopts "s:" arg; do
|
|
case "${arg}" in
|
|
s) service=${OPTARG} ;;
|
|
esac
|
|
done
|
|
|
|
if [ ! -z "${service}" ]; then
|
|
out=`checkservice "${service}" "${services}"`
|
|
[ $? -ne 0 ] && echo "service: ${out} not found" && bot_sh_usage && exit 1
|
|
else
|
|
service="all"
|
|
fi
|
|
|
|
case "$1" in
|
|
"start")
|
|
start_service "${service}"
|
|
;;
|
|
"stop")
|
|
stop_service "${service}"
|
|
;;
|
|
"restart")
|
|
stop_service "${service}"
|
|
echo "wait ${waittimer} seconds"
|
|
sleep ${waittimer}
|
|
start_service "${service}"
|
|
;;
|
|
"setuptg")
|
|
echo "${service}"
|
|
bin/setuptg.php
|
|
;;
|
|
"status")
|
|
status_service "${service}"
|
|
;;
|
|
*)
|
|
bot_sh_usage
|
|
;;
|
|
esac
|
|
|