Operating System - HP-UX
1753797 Members
9130 Online
108805 Solutions
New Discussion юеВ

Re: HP/UX cron every five minutes

 
dan dobbs
Frequent Advisor

HP/UX cron every five minutes

Greetings, all. In Red Hat, I can set a cron job to fire off every five minutes with */5 * * * * /commandgoeshere. HP/UX doesn't seem to dig that syntax. What's the workaround (besides 5,10,15,20,25,....)?

TIA,

-dd
Hey, that's not a spoon.
11 REPLIES 11
Patrick Wallek
Honored Contributor

Re: HP/UX cron every five minutes

With cron, there really isn't a workaround. If you want it to run every 5 mintes you have to do

0,5,10,15...... * * * * command

Another option for you may be to use 'at' to schedule the job.

Once the job finished you could have it reschedule itself by doing something like:

at -f job_file_name now + 5 minutes

as the last line in the script.

See 'man at' for more information and examples.
A. Clay Stephenson
Acclaimed Contributor

Re: HP/UX cron every five minutes

When you uses non-standard syntax, you pays the price. Linux has "improved" the cron syntax - that needed no improvement. UNIX guys tend to very conservative about changes to things that have literally been in use for decades.
If it ain't broke, I can fix that.
Rodney Hills
Honored Contributor

Re: HP/UX cron every five minutes

If I have a process that needs to run multiple times per hour, I launch it and have it remain resident. It then sleeps until the next process cycle.

This will cut down on the number of new processes that are created by cron.

HTH

-- Rod Hills

There be dragons...
Steven E. Protter
Exalted Contributor

Re: HP/UX cron every five minutes

I use HP-UX and Linux and to keep my head from overloading I use the old UX syntax on both platforms.

Just my advice.

5,10,15,20,25,.... isn't a workaround, it the right way to do it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
doug hosking
Esteemed Contributor

Re: HP/UX cron every five minutes

I'm not sure what the job does, but you might think about using 'at' jobs that resubmit themselves with an appropriate delay when completed. This may or may not be suitable depending on how important it is to run the jobs on a precise schedule, as opposed to just periodically.
Frank Slootweg
Honored Contributor

Re: HP/UX cron every five minutes

Yes, "standard is better than better"!

From the (HP-UX) crontab(1) manual page:

> STANDARDS CONFORMANCE
> crontab: SVID2, SVID3, XPG2, XPG3, XPG4

Balaji N
Honored Contributor

Re: HP/UX cron every five minutes

frank and clay,
sorry to nitpick.
+++++++++++++++++
STANDARDS
The crontab command conforms to IEEE Std1003.2-1992 (``POSIX''). This
new command syntax differs from previous versions of Vixie Cron, as
well as from the classic SVR3 syntax.
+++++++++++++++++

from the crontab man page on a linux box. both satisfy standards, but it depends on which standard u decide.

hth
-balaji
(no, i am not starting a flame here.)
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Frank Slootweg
Honored Contributor

Re: HP/UX cron every five minutes

Hi Balaji,

It would be interesting to know if the POSIX standard documents the "*/5" form which is the subject with this thread. I.e. the fact that Linux' crontab is POSIX conformant does not neccessarily mean that "*/5" is in the POSIX standard.

*Normally*, but not always, POSIX is a lower, i.e. less functionality, standard than XPG* (SVID* is not relevant if the functionality conforms to XPG*).
Yogeeraj_1
Honored Contributor

Re: HP/UX cron every five minutes

hi,

this should be the only possible way on HP-UX (to date):

#*******************************************************************************
# min|hour |day |month|day |script
# | |of mo| |of wk|
#----|-----|-----|-----|-----|--------------------------------------------------
#*******************************************************************************
0,5,10,15,20,25,30,35,40,45,50,55 * * * * my_scr.sh 1>/home/yogeeraj/logfiles/output-myscr.crn 2>/home/yogeeraj/logfiles/error-myscr.crn

#*******************************************************************************
# min|hour |day |month|day |script
# | |of mo| |of wk|
#----|-----|-----|-----|-----|--------------------------------------------------
#*******************************************************************************
#*******************************************************************************
# END OF TABLE day0->Sunday day6->Saturday
#*******************************************************************************

Best Regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)