I thought I would post over setting up a cron path, so users find it easier as follows:
php -f /chroot/home/siteworx-name/yourdomain.url/html/path/to/cron.php
(you do not have to use /chroot, and some may not have /chroot, so maybe better to use /home/siteworx-name/yourdomain.url/html/path/to/cron.php)
so, if you need to setup a cron, and shown /usr/bin/php -f, please use above
I hope that helps a little
Many thanks
John
can I pick your brain a little more? if I want to log the ouput of each and every cron-job run, I usually add >> logfile.log 2>&1
But php -f /chroot/home/siteworx-name/yourdomain.url/html/path/to/cron.php >> /var/log/logfile.txt 2>&1
or php -f /chroot/home/siteworx-name/yourdomain.url/html/path/to/cron.php >> /chroot/home/siteworx-name/yourdomain.url/html/path/to/logfile.txt 2>&1
don’t work for me. Any ideas why?
And does anyone know/have a list of cron parameters (-f -g -q etc.) ? Google finds millions of hits but no answers
Hi Michael
I hope your well and it’s cooled down a little for you
Good question
You can use the following, which will give you a log file output, but change as needed.
For testing, I used whmcs cron
I think your issue maybe that you are trying to save into a folder which the perms are wrong, and the folder needs to be siteworx:siteworx, or better still, place outside of hosting root, and set siteworx:siteworx 766 or 777
I hope that helps a little
Many thanks
John
php -q /home/unix-name/whmcs_crons/cron.php > /home/unix-name/master.url/html/log/date +\%Y\%m\%d\%H\%M\%S-testcron.log 2>&1
file saved 20170711185401-testcron.log
Thanks! But why -q and not -f here?
And I was looking for a way to add the timestamp to each line of the log file, thus the >>
Do you happen to know that too?
Thanks,
Michael