Help with executing parallel sessions for same shell script with different but fixed parameters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with executing parallel sessions for same shell script with different but fixed parameters
# 8  
Old 12-17-2010
Data help

Again I am facing a problem in this script.
After we have ran above for loop it will generate mulitple o/p files depenind upon condition. Now what I need to do is to combine this o/p in a single file. Then remove blank lines from file and return the record count of the file into the log. I have written the script & this part is working fine if I already have all o/p files created. Then its firstly checking whether the number of records for select statement is matching with files created successfully in the log file. If its so then it will append all o/p files, remove blank lines & return rec count. Otherwise it will sleep for 60 secs and then rerun that function. Now the o/p file (total of 24 o/p files are there) creation takes 7 hrs 30 mins types. When I ran it fully it keep on running the function till 20 files are generated after that its not checking the rec count and doesn't create a full report file.

Code:
 
 
sys_date=`date '+%d_%m_%Y:%H:%M:%S'`
sysdate1=`date '+%d_%m_%Y`
sqlplus -s $ORA_CONN << EOF
SET SERVEROUTPUT ON
SET FEED OFF
spool org.txt
BEGIN
   FOR i IN (SELECT ID FROM table ID<>0)
   LOOP
      DBMS_OUTPUT.put_line ( i.ID);
   END LOOP;
END;
/
spool off
EOF
for i in `cat org.txt`
do
./subscript.ksh $i &
sleep 10
done
cnt1=`sqlplus -s $ORA_CONN <<EOF
SET SERVEROUTPUT ON
SET FEED OFF
SET HEADING OFF
SELECT count(*) FROM table where ID<>0;
exit
EOF`
org_cnt=`echo ${cnt1}`
check_count()
{
count=`grep -c 'Finished successfully' $LOG_FILE`
if [[ ${count} == ${org_cnt} ]] then
grep 'Finished successfully' $LOG_FILE | cut -d" " -f12 > ${file}
        for i in `cat ${file}`
        do
        cat $i >> ${report}
        done
else
        sleep 60
        check_count
fi
}
check_count
grep -v "^$" ${report_name} > ${report_name}.new
mv ${report_name}.new ${report_name}
 
rec_cnt=`wc -l ${report_name} | tr -s " " | cut -d" " -f2`
echo Report has been generated successfully ${report_name} with record count ${rec_cnt} >>$LOG_FILE

# 9  
Old 12-17-2010
I guess $LOGNAME is your common log file where u maintain the status of all finished ./subscript.ksh script. Now u r going to check in loop whether that log file has an entry of all inputted ids, right? And once all scripts running in background finishes, u are going to display Report has been successfully generated. Correct? Please revert with $LOGFILE and correct if I have missed out any point.
R0H0N
# 10  
Old 12-17-2010
Data

Yes you are right. After all the scripts running in background finishes, I need to generate single report by appending these files and then removing blank line from it. Then also need to log record count of final report into the logfile. The logfile is commom n its name is $LOG_FILE.Below is log file I have placed checkpoints in function to check whether its in if loop or else loop and also displayed count of files that have finished their processing running in background after every 1 minute.But if you check here it has stopped displaying the count after [2010-12-17 06:39:56]. Kindly help.

Code:
 
[2010-12-17 04:26:47] PID=27136 START ./subscript.ksh for unit:1001 
[2010-12-17 04:27:00] PID=27781 START ./subscript.ksh for unit:1002 
[2010-12-17 04:27:08] PID=28459 START ./subscript.ksh for unit:1003 
[2010-12-17 04:27:18] PID=28934 START ./subscript.ksh for unit:1004 
[2010-12-17 04:27:28] PID=29567 START ./subscript.ksh for unit:1005 
[2010-12-17 04:27:38] PID=214 START ./subscript.ksh for unit:1006 
[2010-12-17 04:27:48] PID=760 START ./subscript.ksh for unit:2001 
[2010-12-17 04:27:58] PID=1352 START ./subscript.ksh for unit:2002 
[2010-12-17 04:28:09] PID=2004 START ./subscript.ksh for unit:2003 
[2010-12-17 04:28:19] PID=2600 START ./subscript.ksh for unit:2004 
[2010-12-17 04:28:29] PID=3156 START ./subscript.ksh for unit:3001 
[2010-12-17 04:28:39] PID=3836 START ./subscript.ksh for unit:3002 
[2010-12-17 04:28:40] PID=3836 OK ./subscript.ksh - Finished successfully for full report report_3002_17_12_2010:04:28:39.txt
[2010-12-17 04:28:49] PID=4431 START ./subscript.ksh for unit:3003 
[2010-12-17 04:28:59] PID=4999 START ./subscript.ksh for unit:3004 
[2010-12-17 04:29:09] PID=5672 START ./subscript.ksh for unit:4001 
[2010-12-17 04:29:19] PID=6265 START ./subscript.ksh for unit:4002 
[2010-12-17 04:29:28] PID=6815 START ./subscript.ksh for unit:4003 
[2010-12-17 04:29:39] PID=7436 START ./subscript.ksh for unit:5001 
[2010-12-17 04:29:49] PID=8135 START ./subscript.ksh for unit:5002 
[2010-12-17 04:29:59] PID=8703 START ./subscript.ksh for unit:5003 
[2010-12-17 04:30:09] PID=9289 START ./subscript.ksh for unit:5004 
[2010-12-17 04:30:19] PID=9973 START ./subscript.ksh for unit:5005 
[2010-12-17 04:30:29] PID=10521 START ./subscript.ksh for unit:6001 
[2010-12-17 04:30:30] PID=10521 OK ./subscript.ksh - Finished successfully for full report report_6001_17_12_2010:04:30:29.txt
[2010-12-17 04:30:39] PID=10963 START ./subscript.ksh for unit:6002 
[2010-12-17 04:30:40] PID=10963 OK ./subscript.ksh - Finished successfully for full report report_6002_17_12_2010:04:30:39.txt
[2010-12-17 04:30:45] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:31:45] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:31:45] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:32:45] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:32:45] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:33:45] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:33:45] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:34:45] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:34:45] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:35:45] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:35:46] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:36:46] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:36:46] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:37:46] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:37:46] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:38:46] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:38:46] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:39:46] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:39:46] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:40:46] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:40:46] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:41:46] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:41:46] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:42:47] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:42:47] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:43:47] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:43:47] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:44:47] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:44:47] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:45:47] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:45:47] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:46:47] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:46:47] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:47:47] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:47:47] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:48:47] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:48:47] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:49:47] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:49:47] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:50:48] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:50:48] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:51:48] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:51:48] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:52:48] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:52:48] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:53:48] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:53:48] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:54:48] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:54:48] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:55:48] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:55:48] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:56:48] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:56:48] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:57:48] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:57:48] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:58:48] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:58:49] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 04:59:49] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 04:59:49] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:00:49] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 05:00:49] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:01:49] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 05:01:49] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:02:49] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 05:02:49] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:03:22] PID=28934 OK ./subscript.ksh - Finished successfully for full report report_1004_17_12_2010:04:27:18.txt
[2010-12-17 05:03:49] PID=26706 INFO ./allscripts.ksh - ELSE statement count 3
[2010-12-17 05:03:49] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:04:15] PID=2600 OK ./subscript.ksh - Finished successfully for full report report_2004_17_12_2010:04:28:19.txt
[2010-12-17 05:04:49] PID=26706 INFO ./allscripts.ksh - ELSE statement count 4
[2010-12-17 05:04:49] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:05:49] PID=26706 INFO ./allscripts.ksh - ELSE statement count 5
[2010-12-17 05:05:49] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:06:27] PID=214 OK ./subscript.ksh - Finished successfully for full report report_1006_17_12_2010:04:27:38.txt
[2010-12-17 05:06:49] PID=26706 INFO ./allscripts.ksh - ELSE statement count 5
[2010-12-17 05:06:49] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:07:49] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:07:49] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:08:50] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:08:50] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:09:50] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:09:50] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:10:50] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:10:50] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:11:50] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:11:50] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:12:50] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:12:50] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:13:50] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:13:50] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:14:50] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:14:50] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:15:50] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:15:50] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:16:50] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:16:50] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:17:51] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:17:51] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:18:43] PID=9289 OK ./subscript.ksh - Finished successfully for full report report_5004_17_12_2010:04:30:09.txt
[2010-12-17 05:18:51] PID=26706 INFO ./allscripts.ksh - ELSE statement count 6
[2010-12-17 05:18:51] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:19:51] PID=26706 INFO ./allscripts.ksh - ELSE statement count 7
[2010-12-17 05:19:51] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:20:51] PID=26706 INFO ./allscripts.ksh - ELSE statement count 7
[2010-12-17 05:20:51] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:21:51] PID=26706 INFO ./allscripts.ksh - ELSE statement count 7
[2010-12-17 05:21:51] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:22:24] PID=8135 OK ./subscript.ksh - Finished successfully for full report report_5002_17_12_2010:04:29:49.txt
[2010-12-17 05:22:51] PID=26706 INFO ./allscripts.ksh - ELSE statement count 7
[2010-12-17 05:22:51] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:23:51] PID=26706 INFO ./allscripts.ksh - ELSE statement count 8
[2010-12-17 05:23:51] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:24:51] PID=26706 INFO ./allscripts.ksh - ELSE statement count 8
[2010-12-17 05:24:51] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:25:18] PID=27781 OK ./subscript.ksh - Finished successfully for full report report_1002_17_12_2010:04:27:00.txt
[2010-12-17 05:25:51] PID=26706 INFO ./allscripts.ksh - ELSE statement count 8
[2010-12-17 05:25:51] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:26:51] PID=26706 INFO ./allscripts.ksh - ELSE statement count 9
[2010-12-17 05:26:51] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:27:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 9
[2010-12-17 05:27:52] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:28:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 9
[2010-12-17 05:28:52] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:29:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 9
[2010-12-17 05:29:52] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:30:25] PID=8703 OK ./subscript.ksh - Finished successfully for full report report_5003_17_12_2010:04:29:59.txt
[2010-12-17 05:30:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 9
[2010-12-17 05:30:52] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:31:30] PID=9973 OK ./subscript.ksh - Finished successfully for full report report_5005_17_12_2010:04:30:19.txt
[2010-12-17 05:31:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 10
[2010-12-17 05:31:52] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:32:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 11
[2010-12-17 05:32:52] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:33:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 11
[2010-12-17 05:33:52] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:34:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 11
[2010-12-17 05:34:52] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:35:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 11
[2010-12-17 05:35:52] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:36:50] PID=28459 OK ./subscript.ksh - Finished successfully for full report report_1003_17_12_2010:04:27:08.txt
[2010-12-17 05:36:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 11
[2010-12-17 05:36:52] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:37:52] PID=26706 INFO ./allscripts.ksh - ELSE statement count 12
[2010-12-17 05:37:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:38:35] PID=4999 OK ./subscript.ksh - Finished successfully for full report report_3004_17_12_2010:04:28:59.txt
[2010-12-17 05:38:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 12
[2010-12-17 05:38:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:39:51] PID=7436 OK ./subscript.ksh - Finished successfully for full report report_5001_17_12_2010:04:29:39.txt
[2010-12-17 05:39:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 13
[2010-12-17 05:39:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:40:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 14
[2010-12-17 05:40:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:41:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 14
[2010-12-17 05:41:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:42:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 14
[2010-12-17 05:42:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:43:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 14
[2010-12-17 05:43:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:44:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 14
[2010-12-17 05:44:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:45:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 14
[2010-12-17 05:45:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:46:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 14
[2010-12-17 05:46:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:47:32] PID=27136 OK ./subscript.ksh - Finished successfully for full report report_1001_17_12_2010:04:26:47.txt
[2010-12-17 05:47:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 14
[2010-12-17 05:47:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:48:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 15
[2010-12-17 05:48:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:49:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 15
[2010-12-17 05:49:53] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:50:53] PID=26706 INFO ./allscripts.ksh - ELSE statement count 15
[2010-12-17 05:50:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:51:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 15
[2010-12-17 05:51:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:52:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 15
[2010-12-17 05:52:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:53:05] PID=29567 OK ./subscript.ksh - Finished successfully for full report report_1005_17_12_2010:04:27:28.txt
[2010-12-17 05:53:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 15
[2010-12-17 05:53:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:54:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 16
[2010-12-17 05:54:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:55:07] PID=6265 OK ./subscript.ksh - Finished successfully for full report report_4002_17_12_2010:04:29:19.txt
[2010-12-17 05:55:08] PID=6815 OK ./subscript.ksh - Finished successfully for full report report_4003_17_12_2010:04:29:28.txt
[2010-12-17 05:55:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 16
[2010-12-17 05:55:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:56:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 05:56:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:57:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 05:57:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:58:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 05:58:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 05:59:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 05:59:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:00:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 06:00:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:01:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 06:01:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:02:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 06:02:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:03:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 06:03:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:04:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 06:04:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:05:54] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 06:05:54] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:06:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 06:06:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:07:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 06:07:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:08:09] PID=5672 OK ./subscript.ksh - Finished successfully for full report report_4001_17_12_2010:04:29:09.txt
[2010-12-17 06:08:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 18
[2010-12-17 06:08:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:09:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:09:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:10:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:10:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:11:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:11:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:12:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:12:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:13:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:13:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:14:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:14:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:15:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:15:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:16:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:16:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:17:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:17:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:18:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:18:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:19:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:19:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:20:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:20:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:21:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:21:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:22:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:22:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:23:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:23:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:24:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:24:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:25:37] PID=2004 OK ./subscript.ksh - Finished successfully for full report report_2003_17_12_2010:04:28:09.txt
[2010-12-17 06:25:55] PID=26706 INFO ./allscripts.ksh - ELSE statement count 19
[2010-12-17 06:25:55] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:26:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:26:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:27:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:27:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:28:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:28:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:29:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:29:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:30:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:30:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:31:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:31:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:32:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:32:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:33:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:33:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:34:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:34:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:35:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:35:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:36:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:36:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:37:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:37:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:38:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 06:38:56] PID=26706 INFO ./allscripts.ksh - checkcount function
[2010-12-17 06:39:56] PID=26706 INFO ./allscripts.ksh - ELSE statement count 20
[2010-12-17 07:06:20] PID=3156 OK ./subscript.ksh - Finished successfully for full report report_3001_17_12_2010:04:28:29.txt
[2010-12-17 09:21:49] PID=760 OK ./subscript.ksh - Finished successfully for full report report_2001_17_12_2010:04:27:48.txt
[2010-12-17 10:24:59] PID=1352 OK ./subscript.ksh - Finished successfully for full report report_2002_17_12_2010:04:27:58.txt

The log file quite long. Is there any option to attach a file. I am not able to locate any such.
# 11  
Old 12-17-2010
Code:
sys_date=`date '+%d_%m_%Y:%H:%M:%S'`
sysdate1=`date '+%d_%m_%Y`
sqlplus -s $ORA_CONN << EOF
SET SERVEROUTPUT ON
SET FEED OFF
spool org.txt
BEGIN
   FOR i IN (SELECT ID FROM table ID<>0)
   LOOP
      DBMS_OUTPUT.put_line ( i.ID);
   END LOOP;
END;
/
spool off
EOF
for i in `cat org.txt`
do
./subscript.ksh $i &
sleep 10
done
# Why do u need to fire a query in database to get records count??
org_cnt=`wc -l org.txt`
# Why 2 variables needed??
count=0
while [ ${count} == ${org_cnt} ]
do
    count=`grep 'Finished successfully' $LOG_FILE | wc -l`
    sleep 60
done

echo Report has been generated successfully ${report_name} with record count ${rec_cnt}

P.S. I have not added a code for appanding all completed process' individual log into common logfile. That u need to modify. Please revert if any doubt.

Last edited by R0H0N; 12-17-2010 at 07:46 AM..
This User Gave Thanks to For This Post:
R0H0N
# 12  
Old 12-20-2010
Many Thanks Rohon!
I have ran the script as suggested. It's working fine as of now.
Can you please tell me why my logic of implementing it by function didn't work.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Executing SQL's in parallel

Hi Folks, I have requirement to pull a bunch of SQL's from a table in DB and execute them in parallel and update the status of each query as and when they complete. Can you please help me with ideas on how this can be achieved? create table list_of_sql ( id number, full_sql... (3 Replies)
Discussion started by: member2014
3 Replies

2. Shell Programming and Scripting

Parallel for in a Script Shell

Hello, This is my Script which configure a list of nodes. ( 40 nodes, and the configuration 10 minutes) #! /bin/sh if then echo "USE: ./start.sh nodes else nb_lignes=`wc -l $1 | cut -d " " -f1` echo "$nb_lignes machines" for i in $(seq $nb_lignes) //instructions done fi My... (2 Replies)
Discussion started by: chercheur111
2 Replies

3. Shell Programming and Scripting

Pass parameters to a function and running functions in parallel

Hi , I have a script which is using a text file as I/P. I want a code where it reads n lines from this file and pass the parameters to a function and now this script should run in such a way where a function can be called in parallel with different parameters. Please find below my script, it... (1 Reply)
Discussion started by: Ravindra Swan
1 Replies

4. Shell Programming and Scripting

Executing Multiple Queries in parallel in Shell

I have n number of SQL queries needs to executed in Shell. Result of this query need to assign in a variable. Once all the queries are executed script needs to exit. Sample Query: SQL 1: Select Count(*) from TABLE GROUP BY COL1,COL2 SQL 2: Select Count(*) from TABLE GROUP BY COL1,COL2 ... (2 Replies)
Discussion started by: Niranjancse
2 Replies

5. Shell Programming and Scripting

Parallel SQL sessions in shell script

i have 3 sqls , sql 1 and sql 2 shuld run in parallel , but sql 3 should run after completion f sql1 nd sql2, my code is as below, please suggest the changes sqlplus username1/password1@DB1 @sql >> log1 & sqlplus username2/password2@DB2 @sql2 >> log1 & how can i execute the... (7 Replies)
Discussion started by: only4satish
7 Replies

6. Shell Programming and Scripting

Executing two commands in parallel

Hi, I am stuck into a situation where i want to execute a command in my shell script well along with a previous command in order to achieve something but i am not figuring out a way. here is a snippet: service management restart rm -rf lock.file in the above, if you see, i am trying to... (5 Replies)
Discussion started by: sunrexstar
5 Replies

7. Shell Programming and Scripting

Optional Parameters/arguments while executing a script.

Hello, I have a shell script "Test.ksh" and I need to pass 8 parameters/arguments while executing the script ./Test.ksh 1 2 3 4 5 6 7 8 Out of these I want first 3 to be compulsory and rest 5 to be optional. Can you suggest the way to do this like and also how to pass these optional... (3 Replies)
Discussion started by: indrajit_u
3 Replies

8. Shell Programming and Scripting

Executing scripts in Parallel

Hi All, I have 3 shell scripts, Script1,Script2 and Script3. Now I want to run Script1 and Script2 in parallel and Script3 should depend on successful completion of both Script1 and Script2. Could you please suggest an approach of acheiving this... Thanks in advance (2 Replies)
Discussion started by: itsme_maverick
2 Replies

9. Shell Programming and Scripting

Run a same script in parallel with diffs parameters

i have script say some_script.ksh that takes an argument I need to run some_script.ksh in background parallely at the sametime with different arguments. Once all the background jobs complete, i need to run this script again in parallel with another 5 set of arguments. Would really... (1 Reply)
Discussion started by: hyennah
1 Replies

10. Shell Programming and Scripting

Problems executing SQL Plus sessions

If I execute this script: $ORACLE_HOME/bin/sqlplus -s <<EOF > oracle.log $DB_id/$DB_pswd@$DB_server start test.sql EOF the sql script executes with no errors. IF I execute the following script:... (12 Replies)
Discussion started by: mh53j_fe
12 Replies
Login or Register to Ask a Question