Hi All,
Need your inputs for the below.
I have 2 different servers 611 & 610, where i would be running two scripts. And would would be running one script from 611 at every 4 hours to merge the data from the 2 servers into 2 files and send a mail.
so below is the code snippet for 611:
#!/bin/bash
var1=`netstat | grep 16001 | wc -l`
var2=`date`
var3=`psme | grep -i DM_EAI | wc -l`
while true; do
echo $var2 $var1
sleep 1800
done > eai_js_611.csv
while true; do
echo $var2 $var3
sleep 1800
done > dm_eai_611.csv
code snippet for 610:
#!/bin/bash
var1=`netstat | grep 16001 | wc -l`
var2=`date`
var3=`psme | grep -i DM_EAI | wc -l`
while true; do
echo $var2 $var1
sleep 1800
done > eai_js_610.csv
while true; do
echo $var2 $var3
sleep 1800
done > dm_eai_610.csv
Now my question is how to merge the data from 611 & 610 in the below format:
eai_js_counts.csv
Timestamp BRM Servers
611 610
1/28/2013 2:00 AM PST 176 99
1/28/2013 6:00 AM PST 150 115
dm_eai_counts.csv
Timestamp BRM Servers
611 610
1/28/2013 2:00 AM PST 4 5
1/28/2013 6:00 AM PST 4 5
Please share your inputs.
Thanks!!
---------- Post updated at 11:32 PM ---------- Previous update was at 09:44 PM ----------
Can combine the data from 2 servers by using below:
final script on 611:
#!/bin/bash
paste -d '\n' eai_js_611.csv eai_js_610.csv > eai_js_counts.csv
paste -d '\n' dm_eai_611.csv dm_eai_610.csv > dm_eai_counts.csv
Also, from one server can read other server file using ftp, please correct me if I am wrong.
Now the only thing is left how to add the column names to the final output.
Thanks