Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't edit crontab

Status
Not open for further replies.

50Antero

IS-IT--Management
Jun 13, 2005
2
FI
Hi !
I'm trying to change time definition in crontab with crontab -e. When I save the file and check it with crontab -l it's still the same.
I've used this crontab entry a couple of years now on this machine and on 10 others.
I have space in /var and I've restarted cron process a couple of times.
I'm thankful for any help received
Regards Andy
 
Hi,

Did you care about some error message like this when you save your modified crontab (in this case, the change is not made ):

"/tmp/crontabaTDfaa" 62 lines, 2860 characters
140 23 * * 1-5 /outils/savedm.ksh 1>/dev/null 2>&1
crontab: error on previous line; number out of bounds.

 
Check out /var/adm/cron/log - if you'va made any error, it should be in there.

It would also be helpful if you post the crontab -e editing session - or just a few lines of it with what you are trying to do. Perhaps there is an illegal character somewhere in the text you're cutting&pasting... Or perhaps there is an illegal character / syntax error already in the crontab file...



HTH,

p5wizard
 
Hi !
Thanks for your tips. I do not have any errors in crontab log file and I don't get errors when saving the file either.
The only thing I'm doing is changing 15 to 45 (to start DB/2 backup half an hour later.
Best regards Andy
 
Does your crontabs directory /var/spool/cron/crontabs have the correct permissions

Also check the crontab file's permission...

And the crontab command should be u+s, g+s...

On my test box:
dir:
drwxrwx--- 2 bin cron 512 May 4 09:04 crontabs

files:
-rw-r--r-- 1 adm cron 2031 Sep 19 1997 adm
-rw------- 1 root cron 1768 May 4 09:04 root
-rw-r--r-- 1 sys cron 864 Sep 19 1997 sys
-rw-r--r-- 1 root cron 1133 Feb 12 2002 uucp

command:
-r-sr-sr-x 1 root cron 28518 Mar 8 2001 /usr/bin/crontab



HTH,

p5wizard
 
and are you root? if you su'd to root did you su - ? I don't consider using sudo as being root.
 
try this instead of 'crontab -e'. Its what I use all the time and may help you find where the problem is

crontab -l > temp
vi temp
crontab temp

Alex
 
I always thought you had to submit the edited cron jobs - as in: # crontab /usr/spool/cron/crontabs/root - where root is the crontab file that you want to submit for change.
 
No. As long as you do as Alexhu suggests as root (or whatever user you're doing it as), it will write to the correct crontab.
 
on my fedora desktop I have the same problem. If you notice in the bash window the cron is actually given a temp file handle. cron.532345 etc. if you do a simple esc then w it will save your changes to that temp file.

instead of saving with wq! or w or what ever, use ZZ that will save the cron to the original crontab not the temp file location.
 
That's exactly how it should work

crontab -e does a crontab -l to a temp file, starts an editing session, so you can modify that temp file, then after finishing the editing session, crontab <temp file> is run to install the modified crontab contents in /var/spool/cron/crontabs/<username>...

It really doesn't matter how/when you save the temp file...

But as Alexhu suggested, you might want to break the crontab -e into its steps and see if somewhere along the line you get an error message...

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top