I just start working for a company where they have some hundreds of shell scripts running on their batch using a "home made" scheduler and some other scripts are run manually by someone onshore/offshore
- scripts were not writeen following any standard
- scripts are located in different directories (again no standard)
- scripts output files to different directories (again no standard)
- etc
So I was thinking to perform the following steps to find out if a scripts is overruning, if it ran too fast or if the output file generated is too small, too big, etc:
- Colect statistics
- Create my checks
- Alarm
*Without touching any of the existing unix scripts is it possible to *****
1 - Create a new shell script that will monitor all other scripts that are running and create/update the following file in real time (1 file per day)
Script Name pid StartTime EndTime Elapsed time Output files
/app/scripts/scriptA.sh -x 222 1234 18/12/2013 12:00:00 18/12/2013 12:01:00 00:01:00 /app/data/customers222_20131218120000.dat
/app/data/temp/customers222_20131218120000.dat
/app/scripts/scriptA.sh -x 222 2223 18/12/2013 14:00:00 18/12/2013 14:01:00 00:01:00 /app/data/customers222_20131218140000.dat
/app/data/temp/customers222_20131218140000.dat
/app/scripts/scriptA.sh -x 333 1235 18/12/2013 12:00:00 18/12/2013 12:01:00 00:20:00 /app/data/customers222_20131218120000.dat
/app/scripts/scriptB.sh -y 8888 1236 18/12/2013 13:00:00 18/12/2013 13:00:05 00:00:05 /app/data/suppliers888_20131318130005.dat
2 - Load monitor_running_scripts_YYYYMMDD.dat in the database to build my statistics or maybe work with files After some days colecting statistics I will know that
/app/scripts/scriptA.sh -x 222 outputs 2 files and avarage running time is 1 min /app/scripts/scriptA.sh -x 333 outputs 2 files and avarage running time is 20 min
3 - Create the alarm triggers
- If /app/scripts/scriptB.sh took less than 1 minute to run then send an email to support team take a look on it
- If /app/scripts/scriptB.sh took more than 5 minutes to run then send an email to support team take a look on it
I do not have any issues to build steps 2 and 3 as long step 1 is in place. So I would like to hear some suggestions on how to start doing step 1
OS: AIX