Operating System - HP-UX
1825811 Members
2524 Online
109688 Solutions
New Discussion

Re: cronjob not workin for non-root user

 
Jenny John
Advisor

cronjob not workin for non-root user

my cronjob for non-root user was working fine before the restart of the server but after the restart cronjob for non-root user is not working.
12 REPLIES 12
Hakki Aydin Ucar
Honored Contributor

Re: cronjob not workin for non-root user

You got this message when you check via the user account you mentioned:
# crontab -l
crontab: you are not authorized to use cron. Sorry.

You check the /var/adm/cron/cron.allow file,it is probably empty. The you have to put the user name inside the file to allow cronjob.
Jenny John
Advisor

Re: cronjob not workin for non-root user

crontab -l is working
and my user is added in cron.allow file
Hakki Aydin Ucar
Honored Contributor

Re: cronjob not workin for non-root user

did you check the cron logs ? under /var/adm/cron
Jenny John
Advisor

Re: cronjob not workin for non-root user

yes but i didnt find any error over there

my script is running manually & root users cron is running fine

is there any other file to check the cron log for specified user other than root
Dennis Handly
Acclaimed Contributor

Re: cronjob not workin for non-root user

How do you know it isn't working? What do you expect to happen?
Expect mail? Expect an action in a disk file?

>is there any other file to check the cron log

Not really. Have you checked /var/adm/syslog/mail.log?
Have you done a "crontab -e" to make sure cron(1m) knows there is a change?

I assume there is a file in /var/spool/cron/crontabs/ for that user?
Jenny John
Advisor

Re: cronjob not workin for non-root user

actually my script is collecting system stats.. which runs at every 5 mins and the ouput is redirected to a file which is not being updated... but when i run the script manually its working fine.

i have tried crontab -e also..
is there anything else i have to check??
Dennis Handly
Acclaimed Contributor

Re: cronjob not workin for non-root user

>I didn't find any error over there

Do you see your script even being invoked by cron(1m)?

You should see:
> CMD: your crontab line
> username 2910 c Sun Jul 18 13:23:00 PDT 2010
< username 2910 c Sun Jul 18 13:23:16 PDT 2010

The last two are start and stop times.
If you see an entry, you need to debug your script.
Jenny John
Advisor

Re: cronjob not workin for non-root user

i dont see my script even being invoked by cron(1m).
Dennis Handly
Acclaimed Contributor

Re: cronjob not workin for non-root user

>I don't see my script even being invoked by cron(1m).

Restart cron?
/sbin/init.d/cron stop
/sbin/init.d/cron start
Hakki Aydin Ucar
Honored Contributor

Re: cronjob not workin for non-root user

Can you see the cron daemon is running ?
# ps -ef |grep cron
Rita C Workman
Honored Contributor

Re: cronjob not workin for non-root user

Did you make sure that your script has everything it needs within it to run via cron?

Remember, when you're running from cron it needs all the environment made available.

When you're running from command line, you are logged in and have your environment running for you.

Just a thought,
Rita

INH
Regular Advisor

Re: cronjob not workin for non-root user

Hello,
1) firstly you need to check whether your job is invoked by cron or not
# /var/adm/cron/log
....
> CMD: your crontab line
> username 2910 c time of job in cron

& check /var/adm/cron/cron.allow file

2) Give a look on permissions and environment of the file(s)

3)Restart cron & check
/sbin/init.d/cron stop
/sbin/init.d/cron start
# ps -ef |grep cron

5)
--------
my cronjob for non-root user was working fine before the restart of the server but after the restart cronjob for non-root user is not working.
--------
if nothing changed prior to reboot then probably environment variable or you may cross check syntax in crontab -l & crontab -e ( edit)issue. As you said you are able to run it mannually

HTH

Regards,
INH
Knowledge is power