user5740843 user5740843 - 1 year ago 95
PHP Question

Edit cron in PHP

I was wondering if anyone know a way how to display and edit crons from a certain user in PHP? I've tried googling and I couldn't come up with anything.

Alternatively, is there a way to set a certain cron with an ID, so that it's easier to find for editing purposes?


Answer Source

you can use some commands to:

  1. export current crontab: crontab -l > /some/file

  2. do your own cooking with editing this file via php

  3. tell cron to use your edited file : crontab /some/file

using exec() to run those commands should be fine.

Ith seems there are also some libraries out there that would do this for you, like Jobby...