Operating System - HP-UX
1834931 Members
2456 Online
110071 Solutions
New Discussion

Re: What is wrong? -crontab-

 
Lee Tae-kyung
Regular Advisor

What is wrong? -crontab-

I edited crontab as 'crontab -e'.
and I saved as ':wq!'.
but as soon as I did above command, the following error messages is displayed.
"Crontab: can't create crontab file in the crontab directory"
So, I restarted a cron daemon.
/sbin/init.d/cron stop/start.
and I edited crontab file directly in /var/spool/cron/crontabs/root.
But crontab is not executed yet.
Help me~~

Thank you for your kindness in advance.
I think I am a specialist in IT Korea^^. I am a programmer and SE and DBA
24 REPLIES 24
Massimo Bianchi
Honored Contributor

Re: What is wrong? -crontab-

Hi,
if you edit the crontab file directly it is not used, because it is not read.

You shuold stop and start again cron to let it re-read the file.


As for the error, check the permission of the directory.

Did you start cron as root ?

Massimo

malay boy
Trusted Contributor

Re: What is wrong? -crontab-

HI,
If you edited the file /var/spool/cron/crontans manually then you need to start/stop the cron daemons.

regards
mB
There are three person in my team-Me ,myself and I.
Ian Dennison_1
Honored Contributor

Re: What is wrong? -crontab-

The correct way to edit the crontab is by using the 'crontab -e' command (as you did the first time).

check permissions on the crontab directory

/var/spool/cron/crontabs

and permissions on executable

>ll /usr/bin/crontab
-r-sr-xr-x 1 root bin 24576 Nov 14 2000 /usr/bin/crontab
>

Share and Enjoy! Ian
Building a dumber user
Animesh Chakraborty
Honored Contributor

Re: What is wrong? -crontab-

#crontab
e.g
#crontab root (to submit root cron jobs)

From which user are you trying to edit crontab ?
Did you take a backup?
Massimo Bianchi
Honored Contributor

Re: What is wrong? -crontab-

Hi,
permission of my dirs:

cbassi@omih471:/var/spool>ll cron
total 10
dr-xr-xr-x 7 bin bin 1024 Mar 6 15:24 .
dr-xr-xr-x 12 bin bin 1024 Mar 26 2002 ..
dr-x------ 2 root sys 96 Mar 6 15:24 .ataids
dr-x------ 2 root sys 96 Mar 6 15:24 .cronaids
dr-xr-xr-x 2 bin bin 96 Nov 15 2000 atjobs
-r--r--r-- 1 bin bin 335 Nov 14 2000 crontab.root
dr-xr-xr-x 2 bin bin 96 Apr 15 10:19 crontabs
drwxrwxrwt 2 root root 2048 Jun 16 10:37 tmp


and then:

cbassi@omih471:/var/spool/cron/crontabs>ll
total 10
dr-xr-xr-x 2 bin bin 96 Apr 15 10:19 .
dr-xr-xr-x 7 bin bin 1024 Mar 6 15:24 ..
-r-------- 1 root dba 2537 Apr 15 10:19 oracle
-r-------- 1 root sys 631 Mar 6 15:11 root


Massimo



Lee Tae-kyung
Regular Advisor

Re: What is wrong? -crontab-

UX17209:/]ls -al /var/spool/cron
??? 8 ???????????????.
drwxr-xr-x 5 bin bin 96 2001.12.04 .
dr-xr-xr-x 14 bin bin 2048 2002.01.28 ..
dr-xr-xr-x 2 bin bin 96 2001.12.04 atjobs
-r--r--r-- 1 bin bin 342 1997.11.07 crontab.root
drwxr-xr-x 2 bin bin 96 6??? 16??? 17:13 crontabs
drwxrwxrwt 2 root root 96 6??? 16??? 17:38 tmp
UX17209:/]ls -al /var/spool/cron/crontabs
??? 4 ???????????????.
drwxr-xr-x 2 bin bin 96 6??? 16??? 17:13 .
drwxr-xr-x 5 bin bin 96 2001.12.04 ..
-r-------- 1 root sys 567 6??? 16??? 17:31 root
UX17209:/]ls -al /var/spool
??? 24 ???????????????.
dr-xr-xr-x 14 bin bin 2048 2002.01.28 .
dr-xr-xr-x 21 bin bin 2048 2001.12.06 ..
drwxrwsrwt 2 daemon daemon 96 5??? 27??? 11:15 calendar
drwxr-xr-x 5 bin bin 96 2001.12.04 cron


UX17209:/]crontab -e

* * * * * test



"/var/tmp/aaaa12896" 7 ???, 567 ???
crontab: can't create crontab file in the crontab directory
UX17209:/]id
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7(lp),20(users)

Help me~~


I think I am a specialist in IT Korea^^. I am a programmer and SE and DBA
Ian Dennison_1
Honored Contributor

Re: What is wrong? -crontab-

Try this,...

strings /var/spool/cron/crontabs/root

# Review to see if it is readable

strings /var/spool/cron/crontabs/root >/tmp/rootscron
rm /var/spool/cron/crontabs/root
crontab /tmp/rootscron

Also, did you check the permissions on /usr/bin/cron executable?

Share and Enjoy! ian

Building a dumber user
john korterman
Honored Contributor

Re: What is wrong? -crontab-

Hi,
if you execute this command:
ls -l /usr/bin/crontab
-r-sr-xr-x 1 root bin 32768 Feb 9 2001 /usr/bin/crontab

do you then see the "s" in the permissions on your system?

regards,
John K.
it would be nice if you always got a second chance
alexandre MARIE
Occasional Advisor

Re: What is wrong? -crontab-


try,

echo "* * * * * test" > cronfile.root
crontab cronfile.root
crontab -l
and check for root in /usr/lib/cron/cron.allow
Massimo Bianchi
Honored Contributor

Re: What is wrong? -crontab-

Hi,
from your name and chars on the screen, i think you come from est.

There might be a problem with the language HPUX thinks it is using.

Have you another working server to check the following variable against?

- LANG
- LC_CTYPE
- LC_MESSAGES

Also:
a history of all actions taken by cron is recorded in
/var/adm/cron/log.
do you have any strange output ?

HTH,
Massimo
Animesh Chakraborty
Honored Contributor

Re: What is wrong? -crontab-

Hi,
Was it working earlier ?
Please check
#more /usr/lib/cron/cron.allow

Did you take a backup?
Lee Tae-kyung
Regular Advisor

Re: What is wrong? -crontab-

UX17209:/]ls -al /usr/bin/crontab
-r-sr-xr-x 1 root bin 32768 Feb 9 2001 /usr/bin/crontab
UX17209:/]cat /usr/lib/cron/cron.allow
root
adm
uucp
UX17209:/]locale
LANG=C
LC_CTYPE="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_MESSAGES="C"
LC_ALL=

UX17209:/]crontab -e

30 22 * * 1-5 su - ubs2 -c "/var/adm/cron_src/batch_proc4.sh" > /var/adm/cron_src/batch_proc4.log
00 01 * * * su - oracle -c "/var/adm/cron_src/dubs1exp.sh"
39 14 * * 0 su - oracle -c "/var/adm/cron_src/exp.sh"
30 19 * * 1-5 /var/adm/cron_src/ftp_cron_hp2.sh
~
~~
"/var/tmp/aaaa15855" 7 lines, 567 characters
crontab: can't create your crontab file in the crontab directory.

Help me~~~

Thank you for your kindness...

From Korea
I think I am a specialist in IT Korea^^. I am a programmer and SE and DBA
T G Manikandan
Honored Contributor

Re: What is wrong? -crontab-

dr-xr-xr-x 23 bin bin 1024 Jul 20 2002 /var
drwxr-xr-x 15 root sys 1024 Apr 9 11:49 spool
dr-xr-xr-x 5 bin bin 1024 Apr 17 2002 cron
dr-xr-xr-x 2 bin bin 96 Jun 11 19:46 crontabs


Also check the permissions for /var/tmp





drwxrwxrwxt 3 bin bin 3072 Jun 16 14:51 /var/tmp
Massimo Bianchi
Honored Contributor

Re: What is wrong? -crontab-

Hi,
if all else fails, and there are no other good advice, the following is the latest cron patch:

PHCO_27141

HTH,
Massimo

Lee Tae-kyung
Regular Advisor

Re: What is wrong? -crontab-

UX17209:/]ls -al /var/tmp
total 56
drwxrwxrwx 5 bin bin 2048 Jun 16 18:25 .
dr-xr-xr-x 21 bin bin 2048 Dec 6 2001 ..
drwxrwxrwx 3 root sys 96 May 19 14:56 BAAa10957
-rw------- 1 ubs2 users 49152 Jun 16 18:07 Ex14851
drwxrwxrwx 2 root sys 96 Mar 12 11:05 ign_configure
drwxrwxrwx 2 bin bin 96 Dec 4 2001 ntp


I checked the permission of /var/tmp, /var/spool/cron, /var/spool/cron/crontabs...

What's wrong?
T T

Thanks many..
I think I am a specialist in IT Korea^^. I am a programmer and SE and DBA
Animesh Chakraborty
Honored Contributor

Re: What is wrong? -crontab-

Hi,
My last weapon
#cat /var/adm/cron/queuedefs
Please give me the output
#man queuedefs for details

Thanks
Animesh
Did you take a backup?
Oliver Stoklossa
Frequent Advisor

Re: What is wrong? -crontab-

Maybe a silly advise, but did you check the available space of your filesystems (bdf)
I once had a similar problem 'cause vi couldn't create a temporary file ...
Michael Tully
Honored Contributor

Re: What is wrong? -crontab-

In my opinion using 'crontab -e' is looking for trouble.

This is the method I would use for root

# crontab -l >/tmp/cron.out
# vi /tmp/cron.out (making your changes and then saving it)
# crontab /tmp/cron.out

and in case the cron process has a problem.

# ps -ef | grep cron | grep -v grep | awk '{print $2}' | xargs kill -5

# /usr/sbin/cron && echo cron started

then repeat the above editing method.

Regards
Michael
"When I have trouble spelling, it's called fat finger syndrome."
Anyone for a Mutiny ?
john korterman
Honored Contributor

Re: What is wrong? -crontab-

Hi,
I did try to post this once, but apparently it was lost..

But you are not the first person facing this problem, e.g.:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xdb258f960573d611abdb0090277a778c,00.html
However, if I read your previous postings correctly, the solution suggested does not apply to your problem. But the last posting in the above mentioned thread leads me to suggest that you temporarily move the file root from the /var/spool/cron/crontabs directory elsewhere, e.g.:
# cd /var/spool/cron/crontabs
# mv ./root

And then try
# crontab -e
which should now create a new /var/spool/cront/crontabs/root file.

regards,
John K.
it would be nice if you always got a second chance
Lee Tae-kyung
Regular Advisor

Re: What is wrong? -crontab-

UX17209:/var/adm/cron]more queuedefs
a.4j1n
b.2j2n90w


I did as your advices.
But, I can't resolve the problem.
And I will continue to resolve the problem
till solving the problem.

Anyway, Thanks many^^


I think I am a specialist in IT Korea^^. I am a programmer and SE and DBA
Michael Tully
Honored Contributor

Re: What is wrong? -crontab-

Might I suggest to see if you have your cron file on backup tape? If so restore it and see if you can re-submit it.
Anyone for a Mutiny ?
Bill Douglass
Esteemed Contributor

Re: What is wrong? -crontab-

If possible, try installing the process tracing utility tusc

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/tusc-7.5/

And run /opt/tusc/bin/tusc crontab -e

You should be able to follow the output and find where in the process the permissions problem is surfacing. That would be a big clue in solving what is happening.
Lee Tae-kyung
Regular Advisor

Re: What is wrong? -crontab-

Thanks many...
Wow, I solved this problem.
I looked into crontab's man pages in detail.
I suspected environmental variable - PATH, SHELL, LOGNAME and so on -
So, I saw .profile of root user.
Oh my God, A few days ago, a unix programmer registered a environmental file for some program.
I commented above part.
and I executed 'crontab -e'.
I successed....

Anyway, Thanks many, forum-people^^

I always receive the help of this forum.

From Korea
I think I am a specialist in IT Korea^^. I am a programmer and SE and DBA
Sunil Talreja
Occasional Advisor

Re: What is wrong? -crontab-

I had the same issue.
check you environment variables
env |grep EDITOR

My EDITOR variable was set to emacs. I changed it to vi and everything worked fine.

Thanks