1 Vote Vote

How to start/stop a cronjob using PHP?

Posted by topdog 326 days ago Questions| php using start All

If I type crontab -l in the command-line I can see the following line:

# * * * * * /usr/bin/php /home/user/every_minute_script.php

To start this cronjob, I need to edit the file using crontab -e command, remove the comment character at the beginning of the line, save the edited file, and exit the editor.

To stop this cronjob, the same steps, but adding the comment character at the beginning of the line.

I want to achieve exactly the same effect using a PHP script, instead of manually editing the file.

Originally asked by: J. Bruni on Stack Overflow

Discuss Bury


Who Voted for this Question