Home » RDBMS Server » Server Administration » cronjob
cronjob [message #221436] Mon, 26 February 2007 14:02 Go to next message
plshelp
Messages: 205
Registered: January 2007
Senior Member
Hi,

I am working on solaris 9 and 9.2.0 database.I am trying to add a script to be run every day using cron.The script that I want to run is in $SCRIPTS location and when I add the cronjob as below:
crontab -e

0 3 * * 1-5
/telk/oracle/admin/scripts/DbMonitor/clean_exp.sh>/tmp/clean_exp.log 2>/dev/null

and I did ZZ (to save)

I dont see the job I added when I do crontab -e or crontab -l.

Could somebody help me?
Re: cronjob [message #221460 is a reply to message #221436] Mon, 26 February 2007 22:11 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

Hi,

Try below procedure.
1.[I]script to be run every day [/I]
oracle@linux]$crontab -e
#press  i or a 
#Run Every day 3 o'clock.
0 3 * * * /telk/oracle/admin/scripts/DbMonitor/clean_exp.sh>/tmp/clean_exp.log 2>/dev/null

Shift+ZZ
-------------------
#Check crontab entry
oracle@linux]$crontab -l
----------------------
#If you want to edit
oracle@linux]$crontab -e
-------------------------
Make sure .sh script have sufficient privs.


regards
Taj
Re: cronjob [message #221573 is a reply to message #221436] Tue, 27 February 2007 09:08 Go to previous messageGo to next message
plshelp
Messages: 205
Registered: January 2007
Senior Member
Hi Taj,

Thats exactly what I did. .sh has priveleges. I think there is something going on the server side. Thanks for your reply.
Re: cronjob [message #221575 is a reply to message #221573] Tue, 27 February 2007 09:12 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

Hi,
Are you sure your .sh script run.
are you like
oracle@linux]$./script_name.sh
what is result ?

regards
Taj
Re: cronjob [message #221637 is a reply to message #221436] Tue, 27 February 2007 19:13 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Including " 2>/dev/null " in a crontab entry BEFORE the script is debugged is not a wise course of action.
IMO, I always start with " 1> /tmp/capture.log 2>&1", until I know all is well.
Without feedback, you are trying to troubleshoot in the dark with your eyes closed.
Re: cronjob [message #221858 is a reply to message #221436] Wed, 28 February 2007 13:06 Go to previous messageGo to next message
plshelp
Messages: 205
Registered: January 2007
Senior Member
Taj,

Yes the clean_exp.sh script runs fine. I tested it out.

Anacedent,

I dont really know what that 2 does there exactly..can you explain it please?
Re: cronjob [message #221878 is a reply to message #221436] Wed, 28 February 2007 14:26 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
File handle #1 is Standard out (STDOUT)
File handle #2 is Standard Error (STDERR)
2>/dev/null send error messages into the bit bucket.
Previous Topic: Problem with ORACLE_SID
Next Topic: 8i to 9i
Goto Forum:
  


Current Time: Fri Sep 20 13:37:08 CDT 2024