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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mystery of the missing crontab file!!!!

Status
Not open for further replies.

BikerGal

Programmer
Jul 12, 2002
17
GB
I cannot see my crontab file in /usr/spool/cron/crontabs but I think it is still there if that makes sense because I am getting results from it. How do I make it appear again???

thanks,
G
 
What does it give you when you do an ls -l or crontab -l?
 
normally crontabs are in /var/spool/cron/crontab(s) -----------
Ohne Intelligenz bist Du ein Fiasko,
ohne Technik ein Amateur und
ohne Herz eine Maschine.

[ Wladimir Horowitz ]
 
Since there is always a root crontab (unless you removed it) why don't you do a find on root. It will show up in the storage place for other crontabs.
Storage location varies by version. Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
Yes the afore mentioned directory is where the root crontab file is. When I logged in as myself (i.e. not root) and do crontab -l in this directory I get:

crontab: can't open your crontab file

I added the lines I need into root because I needed to have my reports working. However, now I am getting 2 of every report which would appear to me to be because there are two crontab files running the same report.

thanks,
G
 

What system is it??

Cheers Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
thanks a lot for all your help.

I ran crontab -l as root from / and got a listing of the lines in the root crontab file.
I ran crontab -l as myuser from / and got crontab: can't open your crontab file

What I had done before was created a file with a list of jobs in it and then used:
crontab <filename> and it worked.
but when I do that now I get: crontab: can't open your crontab file

I am accessing a Sun 0S 5.8 Server from a Red Hat Linux 9 release 2.4.18-3 machine.
 
In etc/cron.d there is no cron.allow. Only the following files: FIFO, at.deny, cron.deny, logchecker, queuedefs.

I am not listed in cron.deny.
 
See what files are listed in /var/spool/cron/crontabs. Below is an example.

root@esso0es0070:/var/spool/cron/crontabs # ls -l
total 15
-rw-r--r-- 1 adm cron 2031 Sep 18 1997 adm
-rw------- 1 informix cron 639 Apr 02 2002 informix
-rw------- 1 root cron 1801 May 31 2002 root
-rw-r--r-- 1 sys cron 864 Sep 18 1997 sys
-rw-r--r-- 1 root cron 1133 Apr 06 2000 uucp

Below is a partial listing of our root cron jobs which can be viewed with crontab -l or by viewing the &quot;root&quot; file.:

#0 3 * * * /usr/sbin/skulker
#45 2 * * 0 /usr/lib/spell/compress
#45 23 * * * ulimit 5000; /usr/lib/smdemon.cleanu > /dev/null
0 11 * * * /usr/bin/errclear -d S,O 30
0 12 * * * /usr/bin/errclear -d H 90
0 3 * * * /usr/remote/bin/skulker 1> /tmp/skulker.log 2>&1
30 0 * * 0 shutdown -Fr
0,30 * * * * /usr/local/bin/up

If you as a user run crontab -l and get a message like the following, that is because you don't have any crontab jobs (or file) in the aforementioned path. This is to be expected for the vast majority of user accounts.

user@esso0es0070:/ $ crontab -l
0481-103 Cannot open a file in the /var/spool/cron/crontabs directory.
A file or directory in the path name does not exist.
 
cron doesn't normally check the crontab files. Usually it only reads them when cron is initialised or it receives an interrupt.

It sounds like your user did have a crontab file created but this has since been deleted, however there is still an image of that file that cron has in memory.

I would suggest stopping and starting the cron daemon to clean out any crap in memory and then manually recreating your users cron file. (check your backups to see if it was saved at any point otherwise you are going to have to type it all in).

use the 'crontab <filename>' method as your user and check that your users crontab file is created OK and then remove the extra entries you added to the root crontab.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top