Solved

Edit Cron Job

Posted on 2006-06-29
7
521 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
  • 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now