Table of Contents
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
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 }