Crontab Scheduling

Sun / Sun-fire-v490
Amit Kumar January 27, 2009 at 02:05:54
Specs: Solaris 5.10, Sparc
Hi I am new to Solaris environemnt I have created a script that takes the backup of oracle database the script is as follow:
#Backup script by Amit Kumar 23-Jan-2009.


expdate=`date '+%d%m%Y'`
dat=`date '+%m%d%y %H:%M:%S'`
echo "Backup started..." $dat;

expdp system/Systempfyi08! FULL=y DIRECTORY=ps DUMPFILE=expdp$expdate.dmp LOGFILE=expdp$expdate.log

echo "Backup Completed." $dat;

gzip /opt/oracle/export/no2p4/ps/expdp$expdate.dmp

And I have tested this script by runing manualy. It is working fine.

But I am facing the problem while I am planning to add this script to cratab file for automating the process.

The crontab file entries are:

30 22 * * * sh /opt/oracle/ >> /opt/oracle/amit_export.log

But as per entry the script does not execute automatically as per time settings.

Please suggest me what to do.....

See More: Crontab Scheduling

January 27, 2009 at 09:40:39
I have 3 observations:

1) When a script fails from cron, but works from the command line, the most common problem is that the shell variables, such as PATH, aren't set. Cron's PATH will not be the same as a typical user's PATH.

You have commented yours out. Why?

Cron's default shell is tyically #!/bin/sh. It's always a good idea to set the proper shell (which you've done).

2) After reviewing your script, it looks like it won't work unless your parent directory contains a directory called expdp. Got that from this:


When cron runs the script, it will probably look in the root directory for directory expdp. Either use full paths for your files or cd to the parent directory where expdp resides before executing the backup.

3) There is no reason to execute the cron command with sh. Change this:

30 22 * * * sh /opt/oracle/ >> /opt/oracle/amit_export.log


30 22 * * * /opt/oracle/ >> /opt/oracle/amit_export.log

Report •

January 27, 2009 at 15:21:40
I agree with cron issue.

"Best Practices", Event viewer, host file, perfmon, antivirus, anti-spyware, Live CD's, backups, are in my top 10

Report •

April 10, 2009 at 04:16:46
Hi all,

Anyone to help me to run my scripts using ksh in Solaris 5.10.

I have tried a simple script using sh but still not working. I already checked cron.allow, and my user is defined. cron.deny also exist in /etc/cron.d but of course my user in not in that file.

Any suggestions.

Your help will be very much appreciated.


Report •

Related Solutions

July 1, 2010 at 04:02:22
Pls run the script manually,from the command line.

Report •

July 16, 2011 at 07:49:45
Hi all,

Anyone to help me how to create the scripts below mentions file names using sh in Solaris 10
my scripts file name is :Checkdisha.log
backup file name is : Checkdisha.logfile

i want to run the scripts every 2 hours

please create scripts

Report •

Ask Question