[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Edit Cron Job

Posted on 2006-06-29
7
Medium Priority
?
536 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 500 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

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

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

I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month20 days, left to enroll

872 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