Bots configuration

What jobs do the bots perform ?

The bots are small scripts which use the VHFFS API to perform the services creation/modification/destruction tasks.

Users enter their requests through the panel. This information is saved in the VHFFS database. Once the bots are running, they read the database and execute the requests.

Bots are located in /usr/lib/vhffs/bots/

To run a bot, just type:

/usr/lib/vhffs/bots/bot_name.pl

Automatically run the bots

It is better to run the bots one by one, not that the bots were not designed to run in parallel, but if you do, you are going to run tens of process simultaneously which use I/O and CPU, which is kind of a bad idea, especially because you want the overall bot processing to be hitless for your hosting.

Create a bots_often script which is going to run bots that need to be run oftenly.

Edit /etc/vhffs/bots_often, here is an example:

#!/bin/sh

for v in cron.pl cvs.pl dns.pl git.pl group.pl group_quota.pl mailinglist.pl mail.pl mercurial.pl mysql.pl pgsql.pl repository.pl repository_quota.pl svn.pl user.pl user_quota.pl usergroup.pl web.pl ; do
      "/usr/lib/vhffs/bots/$v"
done

Then, create a bots_night script which is going to run bots that need to be run at night.

Edit /etc/vhffs/bots_night, here is an example:

#!/bin/sh

for v in mysql_dump.pl pgsql_dump.pl mailinglist_mhonarc.pl object_cleanup.pl user_cleanup.pl ; do
      "/usr/lib/vhffs/bots/$v"
done

Finally create and edit /etc/cron.d/vhffs, a cron file for VHFFS, here is an example:

# Crons for VHFFS
*/15 * * * *  root  ionice -c3 nice -n 10 /etc/vhffs/bots_often
5    3 * * *  root  ionice -c3 nice -n 10 /etc/vhffs/bots_night
0    0 * * *  root  ionice -c3 nice -n 10 /usr/lib/vhffs/bots/web_stats.pl
0    0 * * *  root  ionice -c3 nice -n 10 /usr/lib/vhffs/bots/repository_stats.pl

If ionice is not available on your system, remove the ionice part, but you should really use it, especially for the stats bot which is doing a lot of I/O.

bots_night is set to run in this example at 03:05, this is to deal with the daylight saving time (DST) in CET/CEST (here) which change from 02:00 to 03:00 in spring and from 03:00 to 02:00 in winter. If bots_night were set to run between 02:00 and 03:00, it would be executed 2 times during the move from CEST to CET and not executed at all during the move from CET to CEST.

Logrotate the bot log file

Bots log their activities in /var/log/vhffs.log by default.

In order to keep this log file ease to use create a logrotate script which is going to automatically rotate, compress and remove the log file.

Edit /etc/logrotate/logrotate.d/vhffs, here is an example:

/var/log/vhffs.log {
    weekly
    rotate 52
    compress
    missingok
    notifempty
    create 0640 root root
}
doc/installationguide/basic-robots.txt · Last modified: 2012/10/14 20:30 by laurent
Recent changes RSS feed Creative Commons License Donate Minima Template by Wikidesign Driven by DokuWiki