#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    1
    Rep Power
    0

    Add a value to an output file


    Hi All,

    I am running the below script to bring back a list of values from a job scheduler for a list of assigned jobs in the CORR_TE_CFJobs.txt file

    -----------------------------------------------------------

    #!/bin/ksh


    TMPFILE=/opt/CtrlFrqLx/current/JobOutput5.tmp

    JOBLIST=/opt/CtrlFrqLx/current/CORR_TE_CFJobs.txt

    x=14

    echo "JobName,LastStartDate,LastStartTime,LastEndDate,LastEndTime,LastRunResult,JobStatus,TimeZone,SL A"


    curl -s "(JobScheduler URL):7005/controlFreqWeb/Export_JobDetails?SchedulerName=$1&db=1" | cut -d "," -f 2- | sed 's/ //g' >$TMPFILE

    while read line

    do

    JOBNAME=$line

    JOBSTATUS=`grep -w $JOBNAME $TMPFILE | sort | uniq | tail -1`

    echo $JOBSTATUS

    done<"$JOBLIST"

    -------------------------------------------------------------
    This returns the below ouput:

    obName,LastStartDate,LastStartTime,LastEndDate,LastEndTime,LastRunResult,JobStatus,TimeZone,SLA

    CORR_TE,2013-05-16,21:45:37,2013-05-16,21:57:47,SUCCESS,,EDT

    There is no SLA field on the job scheduler, therefore I want to assign this value within the script so that the SLA field will be displayed on the ouput above.

    Please can you advise on the best way to do this please ?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,481
    Rep Power
    1752
    Can you not just change:

    Code:
    echo $JOBSTATUS
    to:

    Code:
    echo "${JOBSTATUS},"
    or
    Code:
    echo "${JOBSTATUS},None"
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo