Operating System - HP-UX
1752575 Members
4130 Online
108788 Solutions
New Discussion юеВ

Re: Unable to set up cron job HP UX

 
4joey1
Occasional Contributor

Unable to set up cron job HP UX


Hallo!I am a total newbie to HP-UX Itanium but have prior experience with Linux.I am trying to set up a cron job to run a script called testscript everyday at 3.20 pm.I have edited the cron script via crontab тАУe as below

5 1 * * * /opt/psb/vacuum
5,20,35,50 * * * * /opt/psb/bin/restart_logserv.sh
5,20,35,50 * * * * /opt/raidsaprovider/bin/restart_raidsaprovider.
sh
5,20,35,50 * * * * /opt/sas/provider/bin/restart_sasprovider.sh
5,20,35,50 * * * * /opt/sfm/bin/restart_sfm.sh
5,20,35,50 * * * * /opt/fcprovider/bin/restart_fcprovider.sh
5,20,35,50 * * * * /opt/dasprovider/bin/restart_dasprovider.sh

20 15 * * * /d01/testscript.sh

But at 3.20 pm the script doesnтАЩt execute.I have edited the cron in Linux in the exact same way and it runs perfectly.

Why cant it run in HP-UX?Also,please explain to me what the numbers 5,20,35,50 mean in HP-UX cron.

Thanks.
4 REPLIES 4
Hakki Aydin Ucar
Honored Contributor

Re: Unable to set up cron job HP UX

The most important thing is that use full path instead of relative patch due to shell restrictions by cron;
look at you script and use full path in every command you put..

Also ,you can check /var/adm/cron/log
g3jza
Esteemed Contributor

Re: Unable to set up cron job HP UX

Hi,

#man crontab

from left: minute hour monthday month weekday

If your script doesn't execute, you can check /var/adm/cron/log for more information .

Are you able to execute the script without using cron?
James R. Ferguson
Acclaimed Contributor

Re: Unable to set up cron job HP UX

Hi:

> But at 3.20 pm the script doesn├в t execute.I have edited the cron in Linux in the exact same way and it runs perfectly.

So, does it execute at 5, 35 and 50 minutes after every hour?

Does the script ever execute under 'cron' in your HP-UX environment?

> Also,please explain to me what the numbers 5,20,35,50 mean in HP-UX cron.

# man crontab

Regards!

...JRF...
Matti_Kurkela
Honored Contributor

Re: Unable to set up cron job HP UX

Welcome to ITRC Forums!

Is the script marked as executable?
e.g.
chmod a+x /d01/testscript.sh

Look in your local email inbox (/var/mail/): any error messages the cron job may produce will be mailed to the user that owns the cron job. The error messages should indicate what's the problem with executing your script.

In HP-UX, the environment of cron jobs is very rudimentary: one of the first lines of your script should probably be:
. /etc/PATH
to load the same PATH environment variable value that is used by regular login sessions.

Look in /var/adm/cron/log: there should be a record indicating the start and stop times of your job. If the stop time record includes "rc=", then your job returned an error code.

The numbers like
5,20,35,50 * * * *
mean the job is scheduled to run at xx:05, xx:20, xx:35 and xx:50 each hour.

MK
MK