General > Helpful posts

Bot Check on Linux

<< < (2/4) > >>

laen:
Updated my scripts a bit so it minimizes the processes that run, and doesn't end up in a defunct launcher shell script.

Crontab:

--- Code: ---*/5 * * * * nohup /path/to/launcher Botname 2>/dev/null 1>&2 &
--- End code ---

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 ---

Resulting processes (ps x):

--- Code: ---  PID TTY      STAT   TIME COMMAND
 7703 pts/5    S      0:17 /usr/bin/php ./Main.php Botname
--- End code ---

Sinaii:
Hello, what the code, for a bot check every 1hour on debian 5 ?

I'm sorry i'm very low skilled in linux system.

Sylfarin:

--- Quote from: Sinaii on September 02, 2009, 01:16:04 am ---Hello, what the code, for a bot check every 1hour on debian 5 ?

I'm sorry i'm very low skilled in linux system.

--- End quote ---

Not sure your question been answered or if you've figured it out yet here is what your crontab should look like:

--- Code: ---0 * * * * yourcommand

--- End code ---

If this doesnt work on your version, which I doubt, you might want to try * */1 * * * instead.

Shelly:
You can also use a line like:

--- Code: ---0 * * * * nohup /path/to/launcher Botname 2>/dev/null 1>&2 &
--- End code ---
in your crontab. This runs the launcher every hour on the hour.

Or if you want to get real specific:

--- Code: ---0 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * nohup /path/to/launcher Botname 2>/dev/null 1>&2 &
--- End code ---
This runs the launcher every hour on the hour also.

Zweiblum:
hmm sorry i realy new to ubuntu hosting here.

I used the last updated script from lean.

in 'crontab -e'

--- Code: ---
# m h  dom mon dow   command

#-----------------------------------------------------------------
# Shell variable for cron
SHELL=/bin/bash
# PATH variable for cron
PATH=/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11
#M   S     T M W   Befehl
#-----------------------------------------------------------------
* * * * * nohup /home/user/bebot/bebot_old/bebot/bot_check.sh botname 2>/dev/null 1>&2 &
* * * * * echo hello
#-----------------------------------------------------------------


--- End code ---

i gave the bot_chech.sh chmod +x

but still its not working.

any ideas?

and is it possible to start a bot in a new "screen" using screen -S or screen -r ?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version