only root's crontab gets not saved


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users only root's crontab gets not saved
# 1  
Old 06-20-2007
only root's crontab gets not saved

Hi,

Something funny is happening over here: when a regular user edits his cron-file (crontab -e) saves and exits vi the correct new cron-file gets installed and saved to disk. But if root does the same, vi saves it but if I then check the cron-file it has the previous contents! I did strace (== truss on other platforms) and I see the following (edited for brievety):
chdir("/var/spool/cron/crontabs") = 0
open("/var/spool/cron/crontab.8195", O_RDWR|O_CREAT|O_TRUNC|O_EXCL, 0600) = 3
chown32("/var/spool/cron/crontab.8195", 0, 0) = 0
open("root", O_RDONLY) = 4
/* fd 4 (original cron file) gets copied to fd 3, then vi gets invoked on crontab.8195 */
/* vi exits */
unlink("/var/spool/cron/crontab.8195") = 0
lseek(3, 0, SEEK_SET) = 0
open("root.new", O_WRONLY|O_APPEND|O_CREAT|O_TRUNC, 0600) = 5
/* copies fd 3 to fd 5
rename("root.new", "root") = 0

So things DO get editted and written correctly but still the output-file is the original?!
crontab version 2.3.3
dcron version 2.3.3
Linux system.
# 2  
Old 06-25-2007
Hi

Tip I can give you is from SunSolaris, I allways create crontab file and edit it with vi and then activate it.

crontab -l > root.crontab

vi root.crontab

(Do your changes)

crontab -r

crontab root.crontab

Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Appending crontab using ssh and sudo without root credentials

Hi, i have two servers say server A and server B. i have a sudo user say user1 with full privilges on server A and B. i am trying to append the crontab entry of root from server A of server B with the following command. But its appending on A. i need to append it on server B. please find the... (4 Replies)
Discussion started by: venkitesh
4 Replies

2. UNIX for Beginners Questions & Answers

How to provide read access to root crontab?

Hi, Is there any safe method to provide read access to root's crontab to another user? Just read no other permissions. (1 Reply)
Discussion started by: ctrld
1 Replies

3. Linux

Trouble with files being saved as root.

I have a customer who is trying to have files saved as owner root in an application home directory. I've tried setting the sticky bit and but am not having luck. They do not have full root or sudo access. User = user123 Group = group123 Files are being saved as user123:group123 but they... (2 Replies)
Discussion started by: rkruck
2 Replies

4. BSD

NetBSD Accidently deleted crontab for root

Someone can told me where from get the default crontab settings of root for NetBSD 6.0 please :) ### SOLVED ### The default crontab rules are in etc.tgz /var/cron/tabs/root # $NetBSD: crontab,v 1.15 2002/11/27 15:09:17 perry Exp $ # # /var/cron/tabs/root - root's crontab for NetBSD #... (0 Replies)
Discussion started by: batence
0 Replies

5. Red Hat

root crontab wont execute a script

Greetings/ I have a script listed in my roots crontab 07 9 * * * /opt/HLRSDATA_2010_OCT/HLRS_Scheduler_sp.sh > /opt/HLRSDATA_2010_OCT/logs/HLRTKJob.log This script contains the following #!/bin/bash echo HLRSData Scheduler cd /opt/HLRSDATA_2010_OCT /usr/bin/java -Xms32m -Xmx1024m -cp... (6 Replies)
Discussion started by: RedSpyder
6 Replies

6. Solaris

Bad user root in crontab

Hi everyone, I got error which is "!bad user (root)" in crontab... I tried changing password, I checked etc/cron/cron.allow and cron.deny, And also I checked the permissions of my files, its(my crontab script) still not working.... Please help... (12 Replies)
Discussion started by: ijustneeda
12 Replies

7. UNIX for Dummies Questions & Answers

Editing crontab of non-root user from file

Hi All, Ref: "build crontab from a text file" in same forum. (I am not allowed to post URL's in the first post) We are reorganizing our UNIX Crontab file by first making changes in a word pad text file. The intent is to then copy it back to Crontab. Will this work? Copy and Paste does not... (6 Replies)
Discussion started by: nivedhitha
6 Replies

8. Solaris

crontab -e as root

So I'm having a problem with crontab -e. It seems like it should work. And it seems like I should know the answer to this question. $ su - # echo $SHELL /bin/sh # crontab -e 372 Any thoughts? (2 Replies)
Discussion started by: adelsin
2 Replies

9. AIX

Crontab cannot run by non-root user

Good morning everybody. I have just receiedv a complaint from our DBA saying that if he create a scripts to run some Oracle performance scripts using crontab and the scheduling part is ok but the job is failed when I checked on /var/adm/cron/log. I have tried his scripts using Oracle id directly... (4 Replies)
Discussion started by: kwliew999
4 Replies

10. UNIX for Advanced & Expert Users

LOST my crontab enteries of root

Hello All, I did very stupid mistake and lost all my crontab enteries on root prompt. Please help me to solve this issue. i did entry on root prompt like this. crontab /home/back.cron and enters but when i enter crontab -l so its only showing 1 entry defined in back.cron and all... (2 Replies)
Discussion started by: wakhan
2 Replies
Login or Register to Ask a Question