I'm using PHP to perform a CRON task. It runs as root.
For example:
php -f /my-cron-folder/my-cron-task.php
Under some circumstances, I want to restart the server's firewall (CSF+LFD) at the end of the script running.
The server has exec
and system
disabled for security.
I could in PHP create or delete a file to act as a trigger for a subsequent CRON task to act on the existence of, or not if it does not exist.
But it's really not a very elegant way of going about it especially because I can't know how long the PHP task will take to complete (it will vary) so I'll have to guess how long after it runs to launch the file existence check.
Any better suggestions?