What is the best way to check the status of individual jobs?
At the moment I'm using the following to call up the status:
./jobscheduler.sh status | grep job_name | grep state | awk '\{print $5\}'| awk -F"=" '\{print $2\}'
This prints the output as continuous data, so it's difficult to check for the status of a particular job.
The output currently looks like:
<?xml version="1.0" encoding="ISO-8859-1"?><spooler><answer time="2013-07-12 12:23:59.402"><state time="2013-07-12 12:23:59" id="scheduler_1" spooler_id="scheduler_1" spooler_running_since="2013-07-10 12:52:01" state="running" log_file="/apps/amr/scheduler/scheduler_1/logs/scheduler-2013-07-10-125201.scheduler_1.log" version="1.3.3124-b118f08157a1f8b18c836653c148c3bde5460575" pid="6596" config_file="/apps/amr/scheduler/scheduler_1/config/scheduler.xml" host="Test-mViewReport" need_db="yes" tcp_port="4460" udp_port="4460" db="jdbc -id=spooler -class=org.postgresql.Driver jdbc:postgresql://localhost:5432/scheduler_db -user=scheduler_user" loop="13956582" waits="3603113" wait_until="2013-07-12 12:24:00.000"><jobs><job path="/AMR_SMS_FDA_DB_LOADER" name="AMR_SMS_FDA_DB_LOADER" job="AMR_SMS_FDA_DB_LOADER" state="pending" title="AMR_SMS_FDA_DB_LOADER" all_steps="1901" all_tasks="1901" log_file="/apps/amr/scheduler/scheduler_1/logs/job.AMR_SMS_FDA_DB_LOADER.log" order="no" tasks="1" next_start_time="2013-07-12 12:24:00.000" in_period="yes" enabled="yes"><file_based state="active" file="/apps/amr/scheduler/scheduler_1/config/live/AMR_SMS_FDA_DB_LOADER.job.xml" last_write_time="2013-05-29T11:39:50.000Z">
We suggest you try:
./jobscheduler.sh status | sed -e 's;><;>\n<;g' | grep job_name | grep state | awk '\{print $5\}'| awk -F"=" '\{print $2\}'
or, to reduce the size of your answer, use:
./jobscheduler.sh command "<show_job job='job_name'/>" | sed -e 's;><;>\n<;g' | grep job_name | grep state | awk '\{print $5\}'| awk -F"=" '\{print $2\}'