System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

how to configure crontab in HP-UX

SOLVED
Go to solution
senthil_kumar_1
Super Advisor

how to configure crontab in HP-UX

Hi

I have worked crontab in linux.

How to configure crontab in HP-UX.

I have follwoing questions

1) how to start / stop
2) how to create / edit / remove crontab of user and root. is it same as linux?
3) where the files "cron.allow and cron.deny" available?
4) where the cron files are stored. like "/var/spool/cron/crontab/root" am i correct?


13 REPLIES
James R. Ferguson
Acclaimed Contributor
Solution

Re: how to configure crontab in HP-UX

Hi:

The simplest way to answer your own questions is to consult the manpages for 'crontab' and 'cron':

http://docs.hp.com/en/B2355-60130/crontab.1.html

http://docs.hp.com/en/B2355-60130/cron.1M.html

A little self research goes an amazingly long way.

...JRF...
Jeeshan
Honored Contributor

Re: how to configure crontab in HP-UX

Let's take a look at how this format fits into the syntax of a crontab entry:
_________________________ 1. Minute - Minutes after the hour (0-59)
|
| ______________________ 2. Hour - 24-hour format (0-23).
| |
| | ___________________ 3. Day - Day of the month (1-31)
| | |
| | | ________________ 4. Month - Month of the year (1-12)
| | | |
| | | | ______________5. Weekday - Day of the week. (0-6, where 0 indicates Sunday)
| | | | |
30 0,12 * * * /some/script/or/command

start and stop cron:

/sbin/init.d/cron stop
/sbin/init.d/cron start

cron permission files location :

/var/adm/cron folder


users cron file location:

yes, you are right.
a warrior never quits
T G Manikandan
Honored Contributor

Re: how to configure crontab in HP-UX

1) /etc/init.d/cron stop
/etc/init.d/cron start

enable cron at /etc/rc.config.d/cron

2) crontab -e , its same as linux

3) /var/adm/cron/cron.allow and deny

4)yes
Sharma Sanjeev
Respected Contributor

Re: how to configure crontab in HP-UX

Hi Senthil

1.how to start / stop

/sbin/init.d/cron stop
/sbin/init.d/cron start

2.how to create / edit / remove crontab of user and root. is it same as linux?

Yes same as linux crontab -l, crontab -e

3.where the files "cron.allow and cron.deny" available?

under /var/adm/cron/

4.where the cron files are stored. like "/var/spool/cron/crontab/root" am i correct?

You are 100% Correct :-)

Regards
Sanjeev

Everything is Possible as " IMPOSSIBLE" word itself says I M POSSIBLE
Ganesan R
Honored Contributor

Re: how to configure crontab in HP-UX

Hi Senthilkumar,

I also go with JRF. There are plenty of informations available on man pages. If you go through man pages you will understand everything yourself.

>>I have worked crontab in linux.<<
Not much difference in HP-UX. mostly same.

1) how to start / stop
/sbin/init.d/cron stop
/sbin/init.d/cron start

2) how to create / edit / remove crontab of user and root. is it same as linux?
#crontab -e /-r

3) where the files "cron.allow and cron.deny" available?
in /var/adm/cron directory.

4) where the cron files are stored. like "/var/spool/cron/crontab/root" am i correct?

/var/spool/cron/crontabs --> here every cron user will have their own cron files
Best wishes,

Ganesh.
Steven E. Protter
Exalted Contributor

Re: how to configure crontab in HP-UX

Shalom,

man crontab

1) Daemon is /sbin/init.d/cron
2) /var/spool the contrab files exist. crontab -l to list crontat -e to edit. The crontab command takes care of file locations.
3) See http://docs.hp.com for more
4) Yes

Syntax is NOT the same as Linux. There are tricks Linux does which go beyond what cron can do under HP-UX. In this case Unix is more standard. Linux extended the RFC


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
OldSchool
Honored Contributor

Re: how to configure crontab in HP-UX

"2) crontab -e , its same as linux"

while that works, I prefer:

crontab -l > some.file
vi some.file
crontab some.file

as all it takes to make your life miserable is a few fat-fingered keystrokes when doing the "crontab -e" method to wipe the file.

Whatever you do, *do NOT* edit the files found in "/var/spool/cron/crontab/" directly...if you save changes there, cron won't re-read the file and "see" them.....
Avinash20
Honored Contributor

Re: how to configure crontab in HP-UX

Also to add, it a good practice to redirect the ouput of the script to a particular file, which will help in trobuleshooting if the cron script fails

eg:

crontab -e
* * * * * /tmp/avi.sh > /tmp/avi.log

If the /tmp/avi.sh fails, you could view the same in /var/adm/cron/log file where rc>0
To find more , you could analyse the logs /tmp/avi.log
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Dennis Ruzeski
Occasional Visitor

Re: how to configure crontab in HP-UX

Do crontab files in HPUX support this syntax to run a job every 3 minutes?

*/3 * * * * /path/to/script

Thank you,

--Dennis
OldSchool
Honored Contributor

Re: how to configure crontab in HP-UX

no...

you'd need 3,6,9,12 and so forth

the method you illustrated is, I believe a GNU / Linux extension.

Dennis Ruzeski
Occasional Visitor

Re: how to configure crontab in HP-UX

Vixie-cron and some of the others support that convention, as well as whatever cron ships with Solaris 10 and it sure is handy for things like that! :-)

Thanks for the info.

--Dennis

Dennis Handly
Acclaimed Contributor

Re: how to configure crontab in HP-UX

>1) how to start / stop

You typically don't have to do this. It is started when the machine boots.

What you do is edit your crontab entries.
Kranti Mahmud
Honored Contributor

Re: how to configure crontab in HP-UX

Hi Senthil,

Check the below links:

http://www.cyberciti.biz/faq/hp-ux-unix-cron-job-configuration-tutorial/

http://nixdoc.net/man-pages/HP-UX/cron.1m.html

Rgds-Kranti
Dont look BACK as U will miss something INFRONT!