Operating System - HP-UX
1821188 Members
3311 Online
109631 Solutions
New Discussion юеВ

Re: Cron only working for root

 

Cron only working for root

Hi All,

I am having a situation where the cron jobs for root are working, however, the cron files for the other users are failing.

Would anyone know, why would all the cron jobs work perfectly for a long time, then all of a sudden only the root cron file works. This is a very strange occurance. I have checked all the permissions and scripts. This box is a replica to another production box, yet the other works perfectly.

All cron users are in the cron.allow file. It can't be the individualy script, because there are mulitple scripts in the users cron file, and they all fail. So there must be something about the user, which cron doesn't like.

In /var/adm/cron/log, next to each script from the cron file in question is a entry which states rc=1. Please assist with any help whatsoever??
4 REPLIES 4
Karthik_2
Regular Advisor

Re: Cron only working for root

I assume you have already checked that only one cron job is running .
You can check/do the following.
1.stop/start cron.
2.check if the FIFO pipe exist for cron and the directories /var/spool/cron and /var/adm/cron exists.

You can try running the scripts from command line as the user to see if they work o.k .This will confirm if the problem is related to permission or with cron

Karthik...
Its ALL in the MATRIX
Ajitkumar Rane
Trusted Contributor

Re: Cron only working for root

I think the rc=1 is nothing the exit code for the failure of the script.
As stated in the previous reply I would suggest running the scripts independent of cron.
You should check the permissions for file/directories etc if they might have changed, and your scripts might be failing access.
Goodluck
Amidsts difficulties lie opportunities
Ulrich Deiters
Frequent Advisor

Re: Cron only working for root

You need a file /var/adm/cron/cron.allow,
which contains the names of the
users (one per line) who are allowed
to run cron jobs.

Similarly, /var/adm/cron/at.allow gives
permissions to submit jobs via "at"
or "batch".
Shannon Petry
Honored Contributor

Re: Cron only working for root

The proper directory for cron.allow and at.allow is "/usr/lib/cron" and NOT /var/adm/cron. I know in HP this is a link to /var/adm/cron, however the global UNIX location is "/usr/lib/cron". If you use the global directory, you can check cron on any UNIX, and not just HP-UX!

Since the user stated that the users had entries in the cron.allow file, this is not the problem.

Look for a few things....
1. make sure cron is running (duh)
2. make sure that the crontabs files for the users are owned by the users! These files should be in "/var/spool/cron/crontabs" If root for example modified a users crontab file with crontab -e, then root now owns the files. Since the user's ID must run the job, they must own their crontab file!
3. Check permissions on the crontabs files to make sure the user can read/write, group read, world read or none.
4. Look at the scripts being called by cron and the directories they live in to make sure the user can access them.

Regards,
Shannon
Microsoft. When do you want a virus today?