AutoSys Workload Automation

 View Only
  • 1.  List of old jobs

    Posted Sep 01, 2020 04:11 PM
    Hello Team , 

    As part of fine tuning the environment . I would like to remove the jobs which are older and have been not executed for many days (since years ). I tried to execute the query using the query select * from ujo_job_runs. it list the jobs which has Start and end time in numeric and not in date format ,.Is there any other method to find the obsolete jobs

    ------------------------------
    Best Regards
    Rajadurai
    ------------------------------


  • 2.  RE: List of old jobs

    Posted Sep 02, 2020 07:06 AM

    It's epoch time just do a conversion and you will be able to use compare..

    However, I wouldn't arbitrarily remove jobs. I would alert owners that a process hasn't run. it is possible it could be a monthly/yearly/adhoc job.

     

     

     

     

    Steve C.

     



    Nothing in this message is intended to constitute an electronic signature unless a specific statement to the contrary is included in this message.

    Confidentiality Note: This message is intended only for the person or entity to which it is addressed. It may contain confidential and/or privileged material. Any review, transmission, dissemination or other use, or taking of any action in reliance upon this message by persons or entities other than the intended recipient is prohibited and may be unlawful. If you received this message in error, please contact the sender and delete it from your computer.





  • 3.  RE: List of old jobs
    Best Answer

    Posted Sep 02, 2020 09:20 AM
    #!/opt/perl/bin/perl
    use Date::Manip;

    $VERYOLD = "2 years";
    $date = &DateCalc("today","- ${VERYOLD}");
    $datestr = UnixDate($date, "%b %d %Y");
    $datenum=UnixDate($date,'%s');

    $sql = "select job_name, job_type, status, create_stamp, create_userid, update_stamp, last_start, last_end, status_time, run_machine from ujo_job,     ujo_job_status where is_active = 1 AND is_currver = 1 AND job_type != 98 AND ujo_job.joid = ujo_job_status.joid and last_start < $datenum and last_end < $datenum and (create_stamp < '${datestr} 12:00 AM' or create_stamp is null) order by last_start";



  • 4.  RE: List of old jobs

    Posted Sep 02, 2020 12:32 PM
    I should script the whole process, but my process is still fairly manual, using autorep.
    When a job gets retired I place it in On Hold status (I use On Hold for long term, On Ice for short term pauses).
    -every so often, I use autorep to list all jobs and grep OH for the on hold jobs, then grep again for the previous year (last run time is output with autorep).
    -I cut the first column (job name) and grep our job name standard (to remove the header and dash dash dash lines) and  redirect it to a file. This is my list of jobs to remove.
    -using the new file as input, I step through each one (Linux command) to output full jil into a file. This is my backup.
    -using another script I use the delete_job jil command and remove the jobs from autosys.

    fairly tedious but not very often so haven't taken the effort to fully script it yet.


  • 5.  RE: List of old jobs

    Posted Sep 03, 2020 07:19 AM
    Try to convert epoch time
    for example 
    TO_CHAR(TO_DATE('01/01/1970', 'MM/DD/YYYY HH:MI:SS AM')+ ((startime - 4*3600)/(60*60*24)),'MM/DD/YYYY HH:MI:SS AM')