Good day,
I am extracting information from Apache log files from 41 servers. Every day I have 7 cronjobs scheduled to do this for me and it works beautifully
... only problem is that it takes about 6-9 hours to run through, as the script runs about 6 ssh commands for each box then goes to the next one.
I am sitting in the development environment and can only ssh in as readonly on the servers, which all sit in prodcution environment. I am not allowed to do anything on the production environment, so ssh is my only option for this one.
Here is a breakdown of my script structure
#!/usr/bin/ksh
ssh_function1()
}
Error_HTTP_403_cre()
{
if `test -f $sshExportFile`; then rm $sshExportFile ; else touch $sshExportFile ; fi
ErrorDesc="HTTP/1.1 403"
ssh readonly@$ServerIP 'YEAR=xx;DAY=xx;MONTH=xx;LMONTH=xx;for i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 \
16 17 18 19 20 21 22 23; grep -c "HTTP/1.1\" \"403" "/var/SP/log/apache/cre/access.log_$YEAR$MONTH$DAY_"*$i.gz ;done'>>$sshExportFile (Export file on dev box)
Sum_to_Oracle #Oracle insert function
echo "$ErrorDesc: $Value" >> $EFCREE
rm $sshExportFile
}
sshfunction()
{
ssh_function1 ; ssh_function2 ; ssh_function3 ; ssh_function#....
}
Servername="A"; serverip=1.1.1.1 ; sshfunction
Servername="B"; serverip=1.1.1.2 ; sshfunction
Servername="B"; serverip=1.1.1.3 ; sshfunction
#... and some more servers
The same commands run on all the servers.
Is there a way I can run the commands that after 5 minutes the script starts with the next server, while still running the sshfunction for the previous servers..
so... time=0
Servername="A"; serverip=1.1.1.1 ; sshfunction #kicks off and runs till finished
time=0+5
Servername="B"; serverip=1.1.1.2 ; sshfunction #kicks off and runs till finished
.. and so on and so forth.
Thanks in advance
msullivan