BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => AO 0.6 support => Topic started by: toxicman on February 09, 2009, 02:29:58 am
-
Hello!
I ran bebot on windows w/o any probs untill i got a new server that has FreeBSD as OS, and it was really tricky to set up and start the bot there :) but finally i managed to do it...
There's one lil problem though. On windows when bot LD's it restarts automatically.. And on *nix it just says "The bot is restarting" and exit program.
i found a solution for that, but i believe there's a better way to solve it.
i've put painbot.sh in rc.d:
#!/bin/sh
./etc/rc.subr
name="painbot"
start_cmd="${name}_start"
stop_cmd=":"
painbot_start()
{
echo "Starting painbot..."
counter=0
while [ $counter -lt 20 ];
do
let counter=counter+1
cd /painbot
/usr/local/bin/php /painbot/Main.php > /dev/null
echo Login attempt $counter finished.
done
}
load_rc_config $name
run_rc_command "$1"
that does the thing.. but its limited, and not correct way to do it.. also if i put $ in the end to hide the process from user, it just starts 20 bots in the same time..
Please help the noob *nix user! :D
thanks!
-
http://bebot.link/bebot-0-6-support/linux/msg11624
http://bebot.link/bebot-0-6-support/how-to-recall-logginf-screen-of-bebot-(ssh)/msg12028
The best way to go about setting up the bot on a *NIX box is to use screen (http://www.gnu.org/software/screen/) to manage the bot.
I do:
screen -dmS botname php StartBot.php
I wouldn't do it from rc.d, unless you have set things up to run as a non-root user.
Here's a script you can put into cron to start the bot for you automatically:
Botname.sh
#!/bin/sh
#Crontab written for BeBot
botname="Botname"
pattern="php Botname.php"
botdir="/home/user/Botname"
command="/usr/bin/screen -dmS Botname /usr/bin/php botname.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
Create a Botname.php file in the same directory as StartBot.php:
<?php
require_once('StartBot.php');
?>
Crontab entry would look like:
*/15 * * * * /path/to/Botname.sh
Cron will run the script every 15 minutes.
-
thanks for the detailed answer :D i will try it when i have time!
-
hey! i've done it all like you said,
everything works fine,
but my bot doesnt wana start on StartBot.php.. even w/o those scripts i do
'php StartBot.php' and nothing happens, just blank string.
bot starts ok with 'php Main.php' .. whats the difference between those two? and any clue how to fix that ?