Crontab refuses to save changes!


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Crontab refuses to save changes!
# 8  
Old 04-05-2005
Thanks for your suggestions guys, sorry for the radio silence, been on holiday up in the mountains and hence arguing with crontab wasn't at the top of my to do list. Anyway back to it...

I've checked the disk usage and there's no problems there.

I've compared the permissions on the existing /var/spool/cron/crontabs/root file (so it must have worked at some point) and the enclosing directories with another more co-operative machine and can find no differences.

cat-ing the root crontab gives:

Code:
 
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.XXXXfllSSh installed on Sun Jun 20 18:46:36 2004)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
0 21 * * * /root/bin/backup.pl

I can touch a file matching my username (as root) in /var/spool/cron/crontabs/ but not under my user account (same behaviour as on the other machine) which I've then 600-ed and root.users-ed to match the permissions on the other machine.

Running:
Code:
crontab -u username /var/spool/cron/crontabs/username

and then cat-ing the file reveals that it has been populated with the cron header:
Code:
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/var/spool/cron/crontabs/username installed on Tue Apr  5 12:57:35 2005)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)

But still crontab -u username -e results in the same error message and the changes not being written to the file.

As for finding documentation for permissions for my OS (debian), I've checked out the man pages for cron and crontab but I'll hunt the web for more info, any suggestions? Also it does talk about making sure that the editor edits the file in place and does not make a copy. I'm using vim which I would have thought wouldn't be a problem but when editing my crontab using a crontab -u username -e does show "/tmp/crontab.XXXX2qwBiu" in the status bar. Although the other machine which plays nice also exhibits this behaviour.
# 9  
Old 04-05-2005
what about creating the crontab file through vi(m), saving it in /tmp, manually moving it to /var/spool/cron/crontabs, and then restarting cron?
# 10  
Old 04-05-2005
Ah ha!

My inkling that the problem may lie with vim seems to have some legs. Temporarily changing the $EDITOR environment variable to /usr/bin/nano and then doing the crontab edit did the job. No more error message and crontab -u username -l reports that the changes were saved successfully. Oh the joy.

Anyone know what vim's problem is? I personally think its just looking for a slap but any other solutions more technical in nature would be gratefully received.
# 11  
Old 04-05-2005
Cheers Ice, just missed your post before posting my last. Thanks for the reply, I've found a workaround now tho. Its not perfect but it gets the job done, any idea why vim doesn't want to play nice with crontab?
# 12  
Old 04-05-2005
i actually don't use vim but i'm guessing that it uses some code that crontab doesn't understand ... anyways, glad to hear you've solved your problem.
# 13  
Old 04-07-2005
Just curious what version of vim you are using? We aren't using the latest one atm, just lazy I guess. We are still on version 5.7.2001-06-12

http://www.vim.org/ You might try the latest version if you are not on it right now.

Also, you can directly edit the crontab file which I suspect you are doing now, but you didnt mention... mine are in /var/spool/cron/crontabs.... hpux.
# 14  
Old 04-08-2005
I'm using vim version 6.1.18, which isn't that old and its the latest available using apt-get.

No, I didn't directly edit the crontab when I got it working, I just temporarily changed the EDITOR environment variable from /usr/bin/vim to /usr/bin/nano and then did a crontab -u username -e.

Having just done a quick google on 'crontab vim' I came across this thread which might have something to do with it. Next time I need to play with crontab, I'll see if .vimrc is causing the problem.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

A function that refuses to run anywhere else but main()

Hi. I have some code, that for some reason, I could not post it here in this post. Here's the address for it: #if 0 shc Version 4.0.1, Generic Shell Script Compiler GNU GPL Version 3 Md - Pastebin.com First off, I used "shc" to convert the code from shell script to C. And The... (6 Replies)
Discussion started by: ignatius
6 Replies

2. Shell Programming and Scripting

Save value from output of Corestat and save in a list for each core

I am trying to modify the "corestat v1.1" code which is in Perl.The typical output of this code is below: Core Utilization CoreId %Usr %Sys %Total ------ ----- ----- ------ 5 4.91 0.01 4.92 6 0.06 ... (0 Replies)
Discussion started by: Zam_1234
0 Replies

3. UNIX for Dummies Questions & Answers

Auto load and save crontab

Hi all, I am trying to simplify things for two people who will be taking over my role whilst i go on leave. In doing so, i wanted to find a way that upon login to unix, the crontab would be reloaddd and resaved. I want to do this due to our IT dept taking the server down more often of late... (5 Replies)
Discussion started by: KlintJ
5 Replies

4. Ubuntu

How to save crontab?

How to save crontab? I have try both method below but can't save it. FIRST METHOD error message hit 'escape' and then the following: :wq http://i.imgur.com/nY2YI.jpg SECOND METHOD error message ctrl + s http://i.imgur.com/ECzl0.jpg (3 Replies)
Discussion started by: mampwamp
3 Replies

5. Solaris

Sendmail refuses to send via relay

Hi I have two realtively identical Solaris zones. They both appear to have the same config in relation to sendmail. But, when I send a test email using mailx the first one sends via a mail relay and the other sends via localhost. I need them both to use the relay but can't figure out what is... (0 Replies)
Discussion started by: gregb
0 Replies

6. UNIX for Advanced & Expert Users

Virtual CDROM refuses to quit

Good day. I have a Sun Netra X4200 M2 server with AMI BIOS. When I performed a iostat -En, I noticed that the AMI Virtual CDROM had taken device id c0t0d0, however, I need c0t0d0 for the real CD/DVD device. So, I disabled the Virtual CDROM in the BIOS and rebooted. Lo and behold, the... (0 Replies)
Discussion started by: BRH
0 Replies

7. Linux

How to save crontab configuration when using SSH?

Hi, I'm trying to save a crontab configuration using SSH, acessing a Linux machine from a Windows desktop. So, in the prompt I type "crontab -e", to edit crontab, and a window is opened. But after writing the changes, I press Save button but it seems not working, because when... (1 Reply)
Discussion started by: Roger75
1 Replies

8. UNIX for Dummies Questions & Answers

can't save crontab with vi

I edit crontab with vi editor, i delete the lines i wanted, but i can't save! i tried the :w, :wq, ZZ commands and it seems like vi is unfamiliar with it. any suggestions? (3 Replies)
Discussion started by: idan_cn
3 Replies

9. Shell Programming and Scripting

how to save crontab

how does one save changes in crontab? i am using vi editor. Issued crontab -e command on the prompt. however not sure how to save changes. :wq doesnt work. any idea.... (10 Replies)
Discussion started by: shahab03
10 Replies

10. UNIX for Dummies Questions & Answers

.netrc refuses password

Hi trying to ftp a printer to collect info but the ftp file shows that when it gets to password the mode is incorrect both the login and the password are not compulsory (e.g. if the user hits the enter button twice the ftp session is initiated) any ideas :confused: (6 Replies)
Discussion started by: w33man
6 Replies
Login or Register to Ask a Question