Reputation: 3172
I've come across a checklist for creating a new PHP cron at my job and one of the directions is:
Add a wrapper file that calls the main part of your job code as cron_[name].sh
A sample cron.sh:
#!/bin/sh
###########################################################
# This job sends out the daily digest emails
###########################################################
. $DS_JOBS_DIR/cron_common.sh
cd $DS_JOBS_DIR/digests
$DS_PHP daily_digest.php
What is the benefit of wrapping a PHP cron inside a shell script?
Upvotes: 1
Views: 309
Reputation: 53636
The only reason I can think of for doing this would be to allow the PHP script to gain access to shell environment variables (i.e., that might contain configuration settings) which get set in cron_common.sh.
Upvotes: 2
Reputation: 8626
No reason.
But you could perform multiple things in the shell script after that - more php or other tasks.
But my main guess is that if you found it in the 'checklist for creating a new PHP cron', then it's is simply how the organisation want things done - due to factors above, or simply how their IT Manager/server administrators are preferring it be done.
Upvotes: 2