Search code examples
autosys

How to configure/run single autosys job on multiple unix servers simultaneously


I am working on shell script which will clean all the older logs and I would like to schedule this job autosys but since I have multiple servers where this job should run hence looking for the information that how to create a single JIL file to run the job on multiple boxes ?

Sample JIL:

insert_job: cleanup    job_type: cmd
description: "This job will  cleanup logs from server"
machine: <server_name>
owner: <user_name>
max_run_alarm: 0
alarm_if_fail: y
alarm_if_terminated: y
date_conditions: y
send_notification: n
days_of_week: we,sa
start_times: "00:00"
command: /test/autosys/cleanup.sh 
std_out_file: >> /test/autosys/cleanup_`hostname`_`date+%Y%m%d`.out
std_err_file: >> /test/autosys/cleanup_`hostname`_`date+%Y%m%d`.err

In another question I read that we can't give multiple server name in machine tag by comma separated because job will run on either of the server. But I want job to be run to all the servers. How to achieve that ?


Solution

  • Achieving by a single job seems not in the scope of Autosys.

    However, the most efficient way to achieve this would be implementing box job.

    Step01: Create individual jobs for each host, Cleanup_on_HostA and Cleanup_on_HostB so on

    Step02: Group the individual job into a box and schedule the box. This way all the jobs inside the box would start parallelly.

    Sample JIL:

    insert_job: Housekeeping_Box
    job_type: box
    date_conditions: y
    days_of_week: we,sa
    start_times: "00:00"
    
    
    insert_job: Cleanup_on_HostA
    job_type: cmd
    box_name: Housekeeping_Box
    description: "This job will  cleanup logs from server"
    machine: <hostA>
    owner: <user_name>
    max_run_alarm: 0
    alarm_if_fail: y
    alarm_if_terminated: y
    command: /test/autosys/cleanup.sh 
    std_out_file: >> /test/autosys/cleanup_`hostname`_`date+%Y%m%d`.out
    std_err_file: >> /test/autosys/cleanup_`hostname`_`date+%Y%m%d`.err
    
    insert_job: Cleanup_on_HostB
    job_type: cmd
    box_name: Housekeeping_Box
    description: "This job will  cleanup logs from server"
    machine: <hostB>
    owner: <user_name>
    max_run_alarm: 0
    alarm_if_fail: y
    alarm_if_terminated: y
    command: /test/autosys/cleanup.sh 
    std_out_file: >> /test/autosys/cleanup_`hostname`_`date+%Y%m%d`.out
    std_err_file: >> /test/autosys/cleanup_`hostname`_`date+%Y%m%d`.err