Automation/cron setup
Main Cron job
To finalize setup, you'll need a properly functioning cron job. Create two cron jobs:
Pointing to the /admin/cron.php file set to run every 5 minutes.
*/5 * * * * php -q /path/to/hb/admin/cron.php
This cron job is responsible for handling all tasks defined under Settings → Task List
Pointing to queue.php to run every minute.
* * * * * php -q /path/to/hb/queue.php
This cron job is responsible for handling background/queue tasks.
Crontab User
When setting up cron tasks make sure to define it under the user that owns your installation directory. Do not use root user as it may cause file permission issues for your web server if cache files were generated during cron run.
queue.php available arguments
When adding crontab entry for queue.php you can add command additional arguments to it:
- -r
This option forces queue to run in foreground mode. In this mode queue will not use forking/workers.
Use this flag/argument on cPanel/shared servers, where queue enabled causes high resources consumption. - -h
Instead of running queue, show help/available options - -v
Enable verbose/debug mode. Use for debugging only without adding it to cron tab. - -Z
Parse command line options and dump config on screen. Use for debugging only without adding it to cron tab. - -D NUMBER
Set maximum number of workers for new queues to run at once - -P FILE
Override PID file, default: /home/hostbill/templates_c/hostbillqueue.pid - -l FILE
Override lob file, default: /home/hostbill/templates_c/hostbillqueue.log - -x SECONDS
Set maximum time (in seconds) worker should live - --hb_acc_provisioning=NUMBER
Set number of workers for Provisioning queue (default: 2). 0 to disable workers on this queue. - --hb_utilities=NUMBER
Set number of workers for Utilities queue (default: 2). 0 to disable workers on this queue. - --hb_dom_provisioning=NUMBER
Set number of workers for Domains queue (default: 2). 0 to disable workers on this queue. - --hb_mail_queue=NUMBER
- Set number of workers for Mailing queue: (default: 3). 0 to disable workers on this queue.