I’m using crontab since a long time and i was wondering if it’s better to make 10 cron or to make 1 cron calling 10 files?
My cron task look like that :
*/1 * * * * wget -o /dev/null -O /dev/null "http://localhost/website1/task.php"
...
*/1 * * * * wget -o /dev/null -O /dev/null "http://localhost/website20/task.php"
And i got like 40 or 50 cron task in total (all calling for some pages on localhost, at different intervals)
So i would like to know if it’s not better to make only one task calling a file which will include the php files for my 20 websites, like :
cron task n1 =>
*/1 * * * * wget -o /dev/null -O /dev/null "http://localhost/call_task.php"
with “call_task.php” calling for :
http://localhost/website1/task.php
to
http://localhost/website20/task.php
Regards,
Both methods will work, but I would always try to group files together. This makes it much easier to manage your cron jobs.
You could also create shell skripts for your jobs, e.g.:
…and set these in your cronjob:
This way you get your scripts easily manageable, you can keep track what to download in which frequency and it keeps your crontab small and manageable.