Operating System - HP-UX
1834082 Members
2237 Online
110063 Solutions
New Discussion

cron command fails many time.

 
SOLVED
Go to solution
fizan
Super Advisor

cron command fails many time.

Cron Command Failure: $HOME/bin/get_locks.sh

when i check the cron it runs evry 5 mins once, so now it stopped executing it.

when i check in cron log no clues there

> CMD: $HOME/bin/get_locks.sh WMPRD.WEBMDBPRDCOM.com > /dev/null
> oracle 20703 c Fri May 28 23:55:00 EST 2010
< oracle 20703 c Fri May 28 23:55:05 EST 2010
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor
Solution

Re: cron command fails many time.

Hi:

The 'cron' daemon has no knowledge of any of the environmental variables you have after your login shells runs unless you explicitly source (read) your login profile or another file of variables.

Without seeing your actual script it is difficult to determine more. I suggest your read the 'crontab(1)' manpages for more insights.

Regards!

....JRF...

fizan
Super Advisor

Re: cron command fails many time.

$ more get_locks.sh
#!/bin/ksh

if [[ -z $1 ]]
then
echo "Argument required!"
echo "Usage: $0 DBservice_name"
echo "Example: $0 repos.aus.hp.world"
exit 1
fi

PATH=$PATH:.:/usr/local/bin:/usr/bin:/usr/ccs/bin:/opt/local/bin

today=`/bin/date +%d%m%y`
export ORACLE_SID=.
export ORAENV_ASK=NO
. oraenv

password=`/bin/cat $HOME/.hpmgmnt`

$ORACLE_HOME/bin/sqlplus -s <>$HOME/log/$1.locks
hpmgmnt/`/bin/cat ~/.hpmgmnt`@$1
select to_char(sysdate,'DD/MM/YYYY HH24:MI:SS') from dual;
@$HOME/sql/locks.sql
exit
EOF

exit 0
james this is the script
fizan
Super Advisor

Re: cron command fails many time.

# Show locks information
0,5,10,15,20,25,30,35,40,45,50,55 * * * 1-5 $HOME/bin/get_locks.sh WMPRD.WEBMDBPRD.NATFOODS.COM.AU > /dev/null

this is the script, as in the day it mentioned as 1-5 so it will not run on saturday right?

date
Sat May 29 06:01:51 EST 2010
James R. Ferguson
Acclaimed Contributor

Re: cron command fails many time.

Hi Again Fizan:

> this is the script, as in the day it mentioned as 1-5 so it will not run on saturday right?

Correct, weekday specifications are 0-6 with 0=Sunday. Hence, your script *will* run at 5-minute intervals at every hour on Monday through Friday; not Saturday or Sunday.

Regards!

...JRF...
fizan
Super Advisor

Re: cron command fails many time.

thanks james.!!!