Solved

Edit Cron Job

Posted on 2006-06-29
7
529 Views
Last Modified: 2010-04-20
Hi there

Dont know too much linux.

I want to add a new cron job to a currently running one. I found where it is stored: /var/spool/cron.

However when I try to edit it using 'vi' it tells me:

DO NOT EDIT THIS FILE - edit the master and reinstall.

Can I edit it? If not how do I go about doing it.

Many Thanks
0
Comment
Question by:AndriesKeun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 22

Expert Comment

by:pjedmond
ID: 17008996
crontab -e

and you'll end up editing your crontab:)
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17009000
Guess you ought to read:

man crontab

as well:)

(   (()
(`-' _\       It's supposed to be a mouse!
 ''  ''
0
 

Author Comment

by:AndriesKeun
ID: 17009037
when i use crontab -e i also get the message: DO NOT EDIT THIS FILE - edit the master and reinstall.

in the directory: /var/spool/cron. there are a couple of files, one of which when i edit it there are two jobs in there, and i know for certain that these jobs run, however when i use crontab -e there are 5 jobs there, and the two that i know run are not in there. so you see, im a bit confused?



0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:AndriesKeun
ID: 17009128
sorry, my mistake, i just switched user.

but I still get the message: DO NOT EDIT THIS FILE - edit the master and reinstall. when i use cronatab -e, so yes or no answer, Is it cool if i edit this file? I cant afford to stuff it up.
0
 
LVL 22

Accepted Solution

by:
pjedmond earned 125 total points
ID: 17009138
OK - looks like you have edited the wrong bits, and the system is now confused about which are the master files!

Setup should have crontabs in the:

/var/spool/cron/ folder as you have alluded to. There should be one for root, one for each user that uses cron, and probably a 'temporary' crontab which I believe is part of the cron calculating and optimisation process.

When you edit your crontab, you should *ONLY* do it via crontab! If you edited the /var/spool/crontab/user file then date/times will have become messed up. You need to edit your crontab, using:

crontab -e

This will edit your crontab. By saving this, I think that the date/times should be re-aligned and stop giving you the aforementioned error.

(   (()
(`-' _\
 ''  ''
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17009145
Yes - using "crontab -e" is the correct way to edit your user crontab.

(   (()
(`-' _\
 ''  ''
0
 

Author Comment

by:AndriesKeun
ID: 17009342
perferct, thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question