1820140 Members
3280 Online
109619 Solutions
New Discussion юеВ

weird crontab error

 
SOLVED
Go to solution
Stephanie L Davenport
Frequent Advisor

weird crontab error

I have tried to edit my crontab file using "crontab -e". But, I get the following error message:

hpbest# crontab -e
crontab: can't open your crontab file.

But, I know that the file exists:

hpbest# cd /var/spool/cron/crontabs
hpbest# ll
-r-------- 1 root sys 4228 Jul 18 15:58 root

Also, if you do a "crontab -l", it shows the file. I _can_ edit the file directly but, feel more comfortable using "crontab -e".

There is an allow file:

hpbest# find . -name cron.allow
./var/adm/cron/cron.allow
hpbest# more /var/adm/cron/cron.allow
root
etc...

This is HP-UX 10.01.

Any ideas?
8 REPLIES 8
Robert-Jan Goossens_1
Honored Contributor

Re: weird crontab error

Hi Stephanie.

corrupted cron file?

# mv /var/spool/cron/crontabs/root /var/spool/cron/crontabs/root.old

# crontab -e

and add the entries from your old cron file.

Hope this helps,
Robert-Jan
Stephanie L Davenport
Frequent Advisor

Re: weird crontab error

Well, that didn't seem to work. :)

hpbest# mv root root.old
hpbest# ll
total 16
-r--r--r-- 1 root informix 2375 Mar 14 11:50 informix
-r-------- 1 root sys 4228 Jul 18 16:33 root.old
hpbest# crontab -e
crontab: can't open your crontab file.

So, I put it back:

hpbest# crontab root.old
warning: commands will be executed using /usr/bin/sh

Rory R Hammond
Trusted Contributor

Re: weird crontab error

Stephanie,

Personally, I do not like to use crontab -e because, I make to many mistakes

I perfer:
crontab -l > root.old
cp root.old root.new
vi root.new (then make the changes)
crontab root.new (activate the changes)

If I get an error or discover a problem,
I have a ready recovery copy.
I regulary compare my saved "golden" copy with the active copy. This helps me track uncontrolled change...

Rory
There are a 100 ways to do things and 97 of them are right
Robert-Jan Goossens_1
Honored Contributor

Re: weird crontab error

Stephanie,

check this doc (HPUX 10.10)

Title: Editing /var/spool/cron/crontabs/file causes problems; use crontab
Document ID: A4581686

http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000062940497

Regards,
Robert-Jan
melvyn burnard
Honored Contributor
Solution

Re: weird crontab error

Question posted in wrong forum, moved to more appropriate forum
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Peter Nikitka
Honored Contributor

Re: weird crontab error

Hi,

to 'refresh' your crontab-entry, do

crontab -l >~/mycrons

Revise the file ~/mycrons , and then activate the new entries via

crontab ~/mycrons

mfG Peter

BTW: HP-UX 10.01, aha.
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Stephanie L Davenport
Frequent Advisor

Re: weird crontab error

I will use the solution of copying the crontab file, editing it and then using #crontab . That seems to be the best solution.

Thanks guys!

Steph
Peter Nikitka
Honored Contributor

Re: weird crontab error

Hi,

glad to hear that our submissions were not complete useless; so look at

http://forums1.itrc.hp.com/service/forums/helptips.do?#28

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"