I want one of my PHP file to be executed when the cron job is executed. I want to do this for updating the database of every users. It is a Banking application project and I need to update every user's account with interest amount. Any other possible approach/suggestion welcomed.
Since there is no standard "A cron job has been created" hook, this would be somewhat non-trivial.
I suppose you could hack cron and run your own custom build of it that would keep a history of the jobs it had seen and run the PHP script if it saw a new one.
Alternatively you could watch for changes to the various files/directories that cron jobs are stored in (e.g.
/etc/cron.*/) using either Inotify or its equivalent on your OS or a cronjob that looks for changes every few minutes.