Executing Unix shell scripts with DBMS_SCHEDULER
I have the following Unix shell script create_backup_file.sh:
#!/usr/bin/ksh
/usr/bin/ssh trotestbat@10.160.41.129 /usr/bin/touch/app_home/home/trotestbat/scripts/TRO_batch_complete_`date +%d-%m-%Y-%H%M`
If I execute this from the command prompt it creates the file on the remote server.
I've used dbms_scheduler to try and execute this from Oracle:
BEGIN
SYS.DBMS_SCHEDULER.CREATE_PROGRAM
(
program_name => 'CREATE_TRO_BACKUP_FILE'
,program_type => 'EXECUTABLE'
,program_action => '/APP/TORPEDO/DTE/SCRIPTS/create_backup_file_tro.sh'
,number_of_arguments => 0
,enabled => TRUE
,comments => NULL
);
SYS.DBMS_SCHEDULER.CREATE_JOB
(
job_name => 'DTE.TESTAGAIN'
,start_date => TO_TIMESTAMP_TZ('2010/05/17 16:09:24.710789 +01:00','yyyy/mm/dd
hh24:mi:ss.ff tzh:tzm')
,repeat_interval => NULL
,end_date => NULL
,program_name => 'DTE.CREATE_TRO_BACKUP_FILE'
,comments => NULL
);
END;
/
The problem I have is that scheduler executes the shell script and creates the file but it never completes the job. The status of the job is permanently 'RUNNING'. Why is the scheduler not returning a completed status?