Reschedule a Job
Scenario Overview
This guide shows how to reschedule CNC server jobs, adjusting parameters like frequency and dates to meet operational needs.
Prerequisites
Before running, get an access token ('Getting Started'), configure cnc-api-common.sh
, and check input/output directories.
Retrieve Devices with a Specific Collection Status
Run the reschedule_job.sh
script from the example directory to reschedule a specific inventory job. Provide the job details in the reschedule_job.json
input file before executing the script.
cd cnc-inventory-api-examples;./reschedule_job.sh
Script Details
#!/bin/bash
. ./cnc-api-common.sh
reschedule_job() {
# Assuming the CNC JWT has already been obtained by running the get-cnc-jwt.sh script.
# Read from JWT file and export it as AUTH_TOKEN_HDR
export_jwt
# STEP 1 : Update the input JSON file (CNC_API_INPUT) with the details of the job to be rescheduled."
# STEP 2 : Trigger the reScheduleJob API
# STEP 3 : Wait for 10 seconds, retrieve the updated job specifications, and copy them to the CNC_API_OUTPUT file.
CNC_API_URL=$CNC_INVENTORY_JOB_API_CTX/reScheduleJob
CNC_API_INPUT="@$PRJ/input/reschedule_job.json"
CNC_API_OUTPUT="$PRJ/output/reschedule_job.json"
http_post $CNC_API_URL $CNC_API_INPUT $CNC_API_OUTPUT
echo -e "\n Waiting 10sec.."
sleep 10
retrieve_job_specifications
echo -e "\n\nUpdated Job Specifications copied to $JOB_SPECS_OUTPUT\n"
}
reschedule_job