Archive > BeBot Hyborian support
Starting Bot as a service on a Linux system
tsafarog:
Thank you very much for your help problem solved
Shelly:
If you are only running a single bot... you can also do
to keep a log:
nohup /usr/bin/php -f <bothome>/StartBot.php <botname> 2>&1 > <bothome>/<botname>.log &
or to maintain space:
nohup /usr/bin/php -f <bothome>/StartBot.php <botname> 2>&1 > /dev/null &
I use a script to start my bots so I don't have to remain logged into the server...
start_<botname>.sh
--- Code: ---#!/bin/bash
#
##
### Check for AO Bots and restart if necessary
##
#
# This script looks to see if your bot is actually running and does nothing if it is
# already running.
# If it is not running, it will email you the previous log, then compress it to concerve space.
# The BOT* items you will need to configure for your bot.
BOTHOME="/home/bot/BeBot"
BOTNAME="Your_Bot_Character_Name"
BOTLOGS="/home/bot"
BOTLOG_Archive=${BOTLOGS}/log_archive
mdate=`date +%b-%d-%Y`;
hdate=`date +%b-%d-%Y_%H%M_hrs`;
z=`ps -ef |grep ${BOTNAME} |grep -v grep`;
if [[ $z == "" ]]
then {
# comment this next line out if you don't want the previous log emailed to you.
mailx -s "Starting ${BOTNAME} bot " [email protected] <${BOTLOGS}/${BOTNAME}.log ;
if [ -e "${BOTLOGS}/${BOTNAME}.log-${mdate}.Z" ]
then {
mv ${BOTLOGS}/${BOTNAME}.log ${BOTLOG_Archive}/${BOTNAME}.log-${mdate};
/usr/bin/compress ${BOTLOG_Archive}/${BOTNAME}.log-${mdate};
}
else {
mv ${BOTLOGS}/${BOTNAME}.log ${BOTLOG_Archive}/${BOTNAME}.log-${hdate};
/usr/bin/compress ${BOTLOG_Archive}/${BOTNAME}.log-${hdate};
};
fi
cd ${BOTHOME}; /usr/bin/php -f ${BOTHOME}/StartBot.php ${BOTNAME} 2>&1 > ${BOTLOGS}/${BOTNAME}.log &
}
fi
#EOF
--- End code ---
Navigation
[0] Message Index
[*] Previous page
Go to full version