Autosys file watcher job, Trigger on file arrival , file comes monthly

2k views Asked by At

I am a .net C# developer and having limited knowledge in autosys script.

We have a monthly file feed(csv).. Comes once in a month .. sometimes twice in a month. My requirement is to run a job which will monitor this file and move to a different directory.

Something I have tried.

/* ----------------- mygroup-feed-myjob ----------------- */ 

insert_job: mygroup-feed-myjob   job_type: b 
owner: myowner
permission: gx,wx
alarm_if_fail: 1
group: mygroup
application: mygroup-feed


 /* ----------------- mygroup-feed-myjob-f ----------------- */ 

 insert_job: mygroup-feed-myjob-f   job_type: f 
 box_name: mygroup-feed-myjob
 machine: mymachine
 owner: myowner
 permission: gx,wx
 description: "File watcher for myjob feed"
 watch_file: $$(mygroup-nas)\DropZone\myfile.csv
 watch_interval: 60
 alarm_if_fail: 1
 group: mygroup
 application: mygroup-feed


 /* ----------------- mygroup-feed-myjob-m ----------------- */ 

 insert_job: mygroup-feed-myjob-m   job_type: c 
 box_name: mygroup-feed-myjob
 command: $$(mygroup-app)\bin\Mover.exe /c myjob /f $$(mygroup-nas)\DropZone\myfile.csv
 machine: mymachine
 owner: myowner
 permission: gx,wx
 condition: s(mygroup-feed-myjob-f)
 description: "Move myjob feed file job into feed directory"
 std_out_file: >>$$(mygroup-nas)\Log\Autosys\$$(gen-sysdate-yyyy)$$(gen-sysdate-mm)$$(gen-sysdate-dd)\mygroup-feed-myjob.log
 std_err_file: >>$$(mygroup-nas)\Log\Autosys\$$(gen-sysdate-yyyy)$$(gen-sysdate-mm)$$(gen-sysdate-dd)\mygroup-feed-myjob.log
 alarm_if_fail: 1
 group: mygroup
 application: mygroup-feed

Problem with this one, It's working fine when I force start the job .. but not triggering on file arrival. .

So practically when it's in SU (Success) status , it's not triggering any job run even I drop the file in that location..I want to trigger the job every time there is a file ..Can someone please help... Probably it's a small trick but I am still learning.

1

There are 1 answers

0
Piyush On

Once solution could be to schedule the box, the jobs under the box would be activated. I would suggest to get familiarized with the behaviour of box and jobs

update_job: mygroup-feed-myjob
date_conditions: y
days_of_week: all
start_mins: 10, 20, 30, 40, 50, 00

This way the box would be running throughout the day with max of 10 mins of inactivity post successful completion.