General > Helpful posts

Bot Check on Linux

<< < (3/4) > >>

Yite:
I run my bots in screens to prevent them stopping when my ssh session dies.

Zweiblum:
yes, i would liek to know if botcheck can start the bots in screens

And i would be glad to here if i setup up the bot_check script right.

Because when i shutdown the bot, the crontab isnt restarting it.

Zweiblum:

--- Quote from: laen on May 07, 2009, 02:40:54 pm ---Launcher:

--- Code: ---[[ ! $(ps x -o args | grep "/usr/bin/php ./Main.php $1" | grep -v grep | cut -d " " -f 3) = $1 ]] && {
    cd $HOME/dit/to/bot/
    exec /usr/bin/php ./Main.php $1 2>/dev/null 1>&2
}
--- End code ---

--- End quote ---

isnt there a "if" missing at the start pf the script?

Zweiblum:

--- Quote from: laen on February 16, 2008, 07:42:55 pm ---Made a bash script, and since i'm running multiple bots, check the botname, and bot dir.

[*]Works if you're running bots as:[/list]

--- Code: ---php -f StartBot.php <botname>
--- End code ---
[*]Logs are saved in the bot's logdir, with .log instead of .txt.
[/list]

The script:
--- Code: ---#!/bin/bash
### bot crontab script by [email protected]
###
### run as <script_name> <bot_dir> <bot_name> <bot_dimension (1, 2 or 3)>

# code
if [ ! "`ps x -o args | grep "php -f StartBot.php "$2"" | grep -v grep | cut -d " " -f 4`" = "$2" ]; then
        cd "$HOME"/"$1"/; php -f StartBot.php $2 >> log/`echo "$2" | tr "A-Z" "a-z"`\@RK"$3"/`date +%Y-%m-%d.log` 2>&1 &
fi
--- End code ---

Example crontab:
--- Code: ---*/5 * * * * /home/user/bot_check.sh bots/org Botty 1
--- End code ---

--- End quote ---


Hi,
i got this script running now, with a small modification as im not starting the bots with -f parameter.
The newer version doesnt work as mentioned in my other post.

Does someone can tell me how i can now start the bots in a new "screen"  to connect to it and see whats going on?

thx

Kentarii:
Try starting with this:

--- Code: ---screen -S "bebot" -m -d bash -c 'cd ~/bebot/; php -f StartBot.php'
--- End code ---

List your screens

--- Code: ---screen -ls
--- End code ---

Reconnect to your screen

--- Code: ---screen -r bebot
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version