Operating System - Linux
1752777 Members
6026 Online
108789 Solutions
New Discussion юеВ

Cron not working for user

 
David Wall
Advisor

Cron not working for user

Hello,

I have a user (not root) cron job that won't start. Nothing in mail and nothing in /var/log/cron. The crontab is as follows:
## ## * * * /u06/scripts/test1.sh

There is no /etc/cron.allow and /etc/cron.deny is empty. I have tried creating a /etc/cron.allow and putting in the user id with no luck.

The cron log shows the crontab edits but doesn't kick off the job.

I have restarted the crond service and server.

Any thoughts?

Thanks.
6 REPLIES 6
Vitaly Karasik_1
Honored Contributor

Re: Cron not working for user

"#" is a comment, you should change your crontab to

0 0 * * * /u06/scripts/test1.sh


for example, if you want to run this script once a day.
Alexander Chuzhoy
Honored Contributor

Re: Cron not working for user

Try to execute /u06/scripts/test1.sh and see if it works without cron (it has to have exec permissions). One more thing to try is to append redirection of STDERR (errors) to some file and see what you get.
David Wall
Advisor

Re: Cron not working for user

Sorry, I forgot to mention that I put in "# #" just as place holders for my question. I keep changing the # # to whatever time is 2 minutes in the future and wait to see what happens (ie. 55 14 * * * /u06/scripts/test1.sh for 2:55 pm).

I can run the script outside of cron without any problems.

Still no luck yet.

Thanks.
Bill Thorsteinson
Honored Contributor

Re: Cron not working for user

Check the classpath for the script.
Cron runs with a sanitized classpath of
bin:/usr/bin

Try a test script that just runs the env command.
Vitaly Karasik_1
Honored Contributor

Re: Cron not working for user

So you should follow Alexander and Bill suggestinons:
1) check that you can run script via command line
2) compare your command line and crontab's environment variables - PATH and others.
David Wall
Advisor

Re: Cron not working for user

After some "playing" the cron scheduler started picking up and executing the job. I can't say for sure what the answer was. I am now using a blank /etc/cron.deny, no /etc/cron.allow. I restarted the cron scheduler (service crond restart).

The puzzling thing for me is that these are all things I tried before. The cron log shows a lot of edit & list activity for the user but didn't show and CMD activity until it started running.

Thanks to those who replied.