Skip to main content

Posts

Showing posts with the label cron

php cronjob interruption

i have a cronjob in php that calculates few business rules (eg: net rev, gross rev, estimated rev, etc... using standard deviation & other math algo) this cronjob calls multiple cron calls 3 php scripts using exec for each calls i start a process in background and tell the system that jobs x started. eg: here's my logic start main cron start - message cron sub 1 start - message run cron sub 1 cron sub 1 end - message wait until cron sub 1 stop process stuff cron sub 2 start - message run background cron sub 2 // this will automaticaly send a message when this jobs end cron sub 3 start - message run background cron sub 3 // this will automaticaly send a message when this jobs end main cron end - message end what i need to fix is this if someone runs the job manually and cancel it (ctrl+c) or something bad happen in the cron (fatal error or cannot connect to db) or anything else (like not enough memory) i want to stop the cronjob and tell what h