Operating System - HP-UX
1833042 Members
2235 Online
110049 Solutions
New Discussion

how to use cron job on hpux

 
SOLVED
Go to solution

how to use cron job on hpux

I have createa a job by using SAM, but the specified time when the file should start doesn't work any help will be highly appreciated.The file is a batch file which take export of oracle database 10g,If I run manually it works fine.

Thanks
13 REPLIES 13
Ranjith_5
Honored Contributor

Re: how to use cron job on hpux

can you post the output of crontab -l

Regards,
Syam
Mel Burslan
Honored Contributor

Re: how to use cron job on hpux

make sure your oracle user (or whichever is going to run this job) is included in /var/adm/cron/cron.allow for starters
________________________________
UNIX because I majored in cryptology...
RAC_1
Honored Contributor

Re: how to use cron job on hpux

cron environment intentionally very minimal. So you need to take care of all environment variables, executable paths etc.

Set your environment properly and you shuold not have any problem.
There is no substitute to HARDWORK
Raj D.
Honored Contributor
Solution

Re: how to use cron job on hpux

Hi Syed ,

You can do this from command line as follows:

1./var/adm/cron/cron.allow add the username to allow cron.

2. $ crontab -e

3. Add the cron entry , example.

30 1 * * 0 /usr/local/bin/weekly_ignite_bk > /dev/null 2>&1
#[ Every Sunday Ignite backup at 1.30am ]

Hope this may help,
Cheers,
Raj.

" If u think u can , If u think u cannot , - You are always Right . "
Geoff Wild
Honored Contributor

Re: how to use cron job on hpux

http://docs.hp.com/en/5990-8172/ch09s02.html#cron

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Raj D.
Honored Contributor

Re: how to use cron job on hpux

Syed ,

Also remember tese useful fields for cron:

minute The minute of the hour, 0-59

hour The hour of the day, 0-23

monthday The day of the month, 1-31

month The month of the year, 1-12

weekday The day of the week, 0-6,

0=Sunday.
-------------------------------------------

for details , use $ man crontab

Cheers ,
Raj.

" If u think u can , If u think u cannot , - You are always Right . "
yut
Advisor

Re: how to use cron job on hpux

1. makesure cron daemon is running.
#ps -ef|grep cron
if not running, do this command:
#/sbin/init.d/cron start

2. makesure user that run this cronjob exist at /var/adm/cron/cron.allow

enjoy with hpux,

thx,

-yut-
Yogeeraj_1
Honored Contributor

Re: how to use cron job on hpux

hi,

we run something similar, here what we have in our crontab of the root user. Alternatively, you can allow the oracle user to schedule jobs using CRON and run the same.

file attached.

hope this helps!
regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: how to use cron job on hpux

hi again,

Forgot attachment.

Also, make sure that it work by running a demo code which can be as follows:
19 08 * * * echo "/home/oracle10g/testconnect.sh" | su - oracle10g 1>/home/oracle10g/logfiles/output-test.crn 2>/home/oracle10g/logfiles/error-test.crn


(where 08:19 is the current time)

also
create the test script (testconnect.sh) such that:
#more testconnect.sh
sqlplus / <select sysdate from dual;
exit;
EOF


hope this helps!

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

Re: how to use cron job on hpux

I will be checking the solutions provided
thanks for ur kind help...
and will soon update this forum with complete details.

Thanks,
SyedMoin
Himanshu_3
Valued Contributor

Re: how to use cron job on hpux

Hi Syed,

Please check the below link , hope you get more details there ...

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=947212

Rgds,
Himanshu
Borislav Perkov
Respected Contributor

Re: how to use cron job on hpux

Hi,
Try to find is the cron job run with the environment variables for the user that creates that job, or is that script uses proper shell, I mean is it the same shell as you are in when you starting it manually.
Regards,
Borislav

Re: how to use cron job on hpux

My cron is working , I have added through SAN and added oracle user in cron.allow file,
its working fine now thanks for help to all...

In the mail message #/var/mail/root I seen the complete log file of export database, the size will increase soon.it means it will create whenever the cron job will run, I have to truncate this file manually when it full right.

REgards,
Syed