Execute Shell Script from CRONJOB

Hi Users,

I am Newbie to linux and cron. I have a requirement to run a job at 8 AM every Sunday.

I am using RHEL 5. Based on the hints through google search I created
crontab and added entry to call the shell script which will in turn login to Oracle user and execute a pl/sql block.

When I run the shell script seperately it works fine. But when included inside the cron it doesn't work.

Here is the crontab
------------------
[root@dstore ~]# crontab -e

0 8 * * sun /opt/media/oracle-scripts/oracle-call.sh

oracle-call.sh file has the following entries
----------------------------------------
#!/usr/bin/sh
su - oracle << EndOfFile
sqlplus -s reporter/reporter@orcl << EndOfFile
@/opt/media/oracle-scripts/create_table_interface.sql;
quit
EndOfFile

-rwxrwxrwx 1 root root 157 Dec 18 17:12 oracle-call.sh

Can someone please guide me where I am going wrong?

Thanks.
RaviShankar.

where you have "sun" in the crontab file, it should be 0.
the days of the week are numerical values.

1 Like