Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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)
Ralph Grothe
Honored Contributor

Re: HP/UX cron every five minutes

Dan,

unfortunately HP-UX uses a "dated" cron version (or to put it more friendly, a more coservative).

Belaji has already cited that the improved cron Linux and the free *BSDs use originated from Paul Vixie, thus usually called vixie-cron.

Since the vixie-cron hasn't been maintained for the last couple of years either the GNU FSF intends to replace it by gcron

http://www.gnu.org/software/gcron/

Madness, thy name is system administration
Adminprem
Occasional Visitor

Re: HP/UX cron every five minutes

Thanks for this .its working fine.