i have a scenario where in i have to monitor jobs which run in different servers, The job details(job name, host server, etc) are present in a dat file.
I have written a script a script which reads the details from the dat file and calls a local method where the job monitoring logic is present.
The script is working fine and the job are being monitored sequentially i.e one job at a time.
I want to monitor the jobs concurrently that is call the local method in a subshell so that each of the job is monitored concurrently.
i have added logic for creating subshell (appended & at the end of the method ) for each of the job but the jobs are still being monitored sequentially.
Is ther any other way of calling the local method in sub shell ?
Monitoring script
monitor_job() {
# Monitoring logic
}
while IFS='|' read JOB_NAME DEST_HOST CONCURRENT
do
if [[ -n "$JOB_NAME" && "$JOB_NAME" != *#* ]]
then
monitor_job $JOB_NAME $DEST_HOST $CONCURRENT
fi
done < "$DAILY_JOBS"
Input dat file
##########################################################
## List of Daily Jobs that are to be monitored
#
## Job Name | Host Server | Concurrent Process
##########################################################
Job1|host1|&
Job2|host2|&
Job3|host3|&
Job4|host4|&
Job5|host5|&