BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => BeBot 0.5 support => Topic started by: xlDanek on November 08, 2008, 09:01:14 pm

Title: How to auto start BeBot with Linux
Post by: xlDanek on November 08, 2008, 09:01:14 pm
Hey guys!

I have a linux root server (SUSE) running and i wonder how i can auto start Bebot after a reboot of the server. Could anyone give me a quick tutorial how to configure this?

Thanks a lot for your future answers!
Title: Re: How to auto start BeBot with Linux
Post by: Wolfbiter on November 09, 2008, 01:06:56 pm
You need to setup a crontab that'll call a check script...

Code: (crontab) [Select]
0,15,30,45 * * * * /home/username/name_of_chk_file >/dev/null 2>&1

Code: (name_of_chk_file) [Select]
#!/bin/sh
#Crontabscript written for BeBot

botname="NameOfBot"
pattern="php start.php"
botdir="/home/username/botDir"
command="/usr/bin/screen -dmS bot /usr/bin/php start.php"

if ps x | grep "$pattern" | grep -v grep
then
        echo $botname "is still running."
        exit 0
else
        echo "Starting "$botname
        cd $botdir
        $command
        exit 1
fi

You just have to edit the paths and possible filenames you run (on a multi-bot system renaming start.php to botname.php would make sense, but then you have to change start.php in the script to botname.php instead.

This is what I use for myself, if you can't get it working I will not help you! Use it at your own risk. There's also other posts about this if you do a search for "crontab".
Title: Re: How to auto start BeBot with Linux
Post by: Temar on November 09, 2008, 05:50:25 pm
Wolf, your advice contains alot of inorrect stuff (prob old )
the main file is StartBot.php
it supports multi bots useing php StartBot.php botname

anyway this is how i have done it

ok this is the system i use

My script works well with multi bots useing screens

for starter i have a script file in the root directory of the bot folder
/home/Bots/all/ being the folder your bot is in

start_botname
Code: [Select]
cd /home/Bots/all/; su -c "php StartBot.php leetboss" Bots
Where Bots is the user that owns/runs the bots

then in etc/init.d/ i got the file names Botname
Code: [Select]
#!/bin/sh

case "$1" in
'start')
screen -dmS botname -s /home/Bots/all/start_botname
;;
'stop')
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0

and ive done that for each bot i run.
Title: Re: How to auto start BeBot with Linux
Post by: xlDanek on November 13, 2008, 10:13:44 pm
Thany you very much, Temar!  :)
SimplePortal 2.3.7 © 2008-2024, SimplePortal