Jump to content

Using PHP to add/edit cronjobs


mraza

Recommended Posts

Hi,

Is there any way i can use a php script to edit crontab jobs. i use this command on my centos based server to add/edit cronjobs. . "crontab -e"

I wants to manage my cronjobs with a php file to add/edit cronjobs.

 

Thans for any help.

Link to comment
Share on other sites

Thank you sir , i checked manual and i see this


SYNOPSIS
       crontab [-u user] file

 

so for example if i execute in my php script

exec("crontab -u username -e cronjobfile.php");

 

will it use that cronjobfile.php to get cron jobs details? so i can add cronjobs to cronjobfile.php with my mysql db something, if you could show me a little bit of example i would really appreciate it sir.

 

Thanks again

Link to comment
Share on other sites

do i need to save that file as somename.txt ?

so it contains lines of crontabs like

 

* * * * /path/to/my/file/to/run

* * * * /path/to/my/file/to/run

 

and where i will store that file somename.txt

 

Thanks for any help.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.