0

I want to edit the crontab of root from the web interface. I have Apache and PHP installed on my Ubuntu. If there is any permissions required please also mention that.

I want to edit the crontab of root. I have some jobs running in that crontab. One of my projects wants me to change the running jobs Time from web interface.

So please tell me how can I access the crontab of root and edit it.

cathulhu
  • 545
  • 1
  • 7
  • 20
Kapila Clan
  • 65
  • 3
  • 10

3 Answers3

1

permission problems: solve those by allowing www-data to run the appropriate commands via sudo.

run crontab -u root -l to get the current crontab, edit it with php string manipulation code of your liking and intall it with crontab -u root $FILE. i recommend to place markers in the file to make it easier to find the correct places to edit like so:

# Edit this file to introduce tasks to be run by cron.
# ...
# m  h  dom mon dow   command
  0 14   27   *   *   backupmails-monthly.sh
  0 14    *   *   5   backupmails-weekly.sh
# MARKER_EDIT_HERE_START
  0 14   27   *   *   job_to_edit.sh
# MARKER_EDIT_HERE_END

a better solution if jobs run regularly: don't put them in the crontab but in /etc/cron/cron.{hourly,daily}.

mnagel
  • 5,938
  • 4
  • 25
  • 63
0

if you have access to the console, you should install webmin for web management interface of the server

http://www.webmin.com/

Valkyrie00
  • 51
  • 1
  • 7
  • Yes but i am building a product that will be accessed by Admins ,and its just for particular purpose.From webmin i can do so many things.But i will surely take look @user2068102. – Kapila Clan Jul 16 '13 at 12:04
  • I may have figured out your problem, but unfortunately I have ever dealt with. You could see here : http://stackoverflow.com/questions/4421020/use-php-to-create-edit-and-delete-crontab-jobs or wait for the response of someone. – Valkyrie00 Jul 16 '13 at 12:12
0

These days there are tools like

Shadi
  • 7,343
  • 3
  • 34
  • 58