There are many things you can do.
Install your cron scripts / binaries (scripts which I think since you mentioned that they are written in PHP) are executed by the owner or group depending on your needs.
If you want to make sure that they are run only by cron, then create the cron user, which is the only user who can execute the script. Then set this user to run in your crontab entry.
Your cron script displays the important things that it does. Prepare your result with a time / date stamp (depending on how often it works). This makes grep easier for a specific time in your log file.
Add the stdout script file to the log file by adding >> /path/cron.log to your crontab entry.
You can also print the start and end times of your cronjob so that you can analyze the log every once in a while to make sure it is not too slow.
Your log file might look something like this:
[ Tue Feb 20, 2012 ]: [ Tue Feb 20, 2012 ]: Executing mycron.php [ Tue Feb 20, 2012 ]: [ Tue Feb 20, 2012 ]: Running Query: ""SELECT SUM(`clicks`) FROM `matable`"" [ Tue Feb 20, 2012 ]: Running Query: ""INSERT INTO `History` (`date`, `total_clicks`) VALUES(CURDATE(), 12324123) [ Tue Feb 20, 2012 ]: [ Tue Feb 20, 2012 ]: Finished executing mycron.php. Time taken: 3.462 seconds [ Tue Feb 21, 2012 ]: [ Tue Feb 21, 2012 ]: Executing mycron.php [ Tue Feb 21, 2012 ]: [ Tue Feb 21, 2012 ]: Running Query: ""SELECT SUM(`clicks`) FROM `matable`"" [ Tue Feb 21, 2012 ]: Running Query: ""INSERT INTO `History` (`date`, `total_clicks`) VALUES(CURDATE(), 10376123) [ Tue Feb 21, 2012 ]: [ Tue Feb 21, 2012 ]: Finished executing mycron.php. Time taken: 2.998 seconds
Except for what he does instead of these two random queries, of course.
Paulpro
source share