Hello I have a VPS which is currently running a cron job every 12 hours. The cron job script sets a database entry when it first runs to true so that the script knows that if it is run again and this is set to true then it should exit the script (to prevent overlapping cron jobs). Once the script is finished it resets that database field back to false. The problem is that every now and then my server restarts (about 3AM in the morning) for no apparent reason and therefore the script is terminated without setting the field to false which results in my script never running any more. My question is whether there is a way to automatically run a php script on every system restart? Thanks
You can specify the PHP script in the /etc/rc.local file to execute it during the server reboot. Edit the /etc/rc.local file and specify the php script as