Hi Guys,
I am trying to run a script through contab. The script can only be executed once user logs in as su - oracle. I have tested the script other then cronjob and it executes successfully, more over the paths used in the script are absolute paths.
Crontab entries are as as below.
15,30,45,59 * * * * su -oracle -c /var/opt/log/my.sh
Shell is as below, Shell interacts with the Oracle DB and extracts the required data.
root@ServerA[/var/opt/log]# cat /var/opt/log/db_analy.sh
#!/usr/bin/bash
sqlplus my_usr/my_passwd@ServerA @/var/opt/log/db.sql
root@ServerA[/var/opt/log]# cat db.sql
set HEA OFF
set heads off
set pagesize 0
SPOOL /var/opt/log/db_analyze.log
SELECT Count(*) From T1 WHERE $state = 'O';
SPOOL OFF
exit
If I execute this /var/opt/log/db_analy.sh --- it is executed sucessfully but there is no output wen i added it in conjob.
Any sugesstion will be appriciated.
Thx in advance,
BR//Asteroid