collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18365
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: How to auto start BeBot with Linux  (Read 8678 times)

0 Members and 1 Guest are viewing this topic.

Offline xlDanek

  • BeBot User
  • **
  • Posts: 22
  • Karma: +0/-0
How to auto start BeBot with Linux
« 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!
« Last Edit: November 09, 2008, 10:28:15 am by xlDanek »

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: How to auto start BeBot with Linux
« Reply #1 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".
Too many toons.

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: How to auto start BeBot with Linux
« Reply #2 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.
« Last Edit: November 09, 2008, 05:56:32 pm by Temar »

Offline xlDanek

  • BeBot User
  • **
  • Posts: 22
  • Karma: +0/-0
Re: How to auto start BeBot with Linux
« Reply #3 on: November 13, 2008, 10:13:44 pm »
Thany you very much, Temar!  :)

 

* Recent Posts
0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm ]

* Who's Online
  • Dot Guests: 237
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal