I want to create a simple job who have to execute this shell command:
echo some_text > some_file
The attributes some_text
and some_file
can change between two calls to run_job
so I need to use set_job_argument_value
procedure.
Here is my code:
exec dbms_scheduler.create_job('write_file','executable','/bin/echo',1,auto_drop=>false);
exec dbms_scheduler.set_job_argument_value('write_file',1,'text > /tmp/file');
exec dbms_scheduler.run_job('write_file');
I begin by creating the job who will execute the echo
command. This job will take only argument : text > /tmp/file
.
When I run my job, the procedure works fine but my file is not created. It's like the procedure runs this command: /bin/echo "text > /tmp/file"
.
So I tried with multiples arguments:
exec dbms_scheduler.create_job('write_file','executable','/bin/echo',3,auto_drop=>false);
exec dbms_scheduler.set_job_argument_value('write_file',1,'text');
exec dbms_scheduler.set_job_argument_value('write_file',2,'>');
exec dbms_scheduler.set_job_argument_value('write_file',3,'/tmp/file');
exec dbms_scheduler.run_job('write_file');
Same output and no file created.
So, is it possible to specify the standard input? Or to use this kind of job_action: /bin/echo $1 > $2
?