Folks,
I have a 3 problems. In a sh script, I call a server name from a list and rex to a distant machine to get the boot date.
for i in `cat list`
do
(echo "$i|"; /bin/rexsh $i -l bozo -t10 who -b | cut -d" " -f14-16) >>getBootTimes.out
sleep 1
done
The results are on 2 lines instead of 1.
ServerName1_K044|
Jul 10 05:30
ServerName2_K044|
Oct 2
ServerName3_K044|
Jul 19 14:15
ServerName4_K044|
Sep 29 10:22
I would like to get the info on the same line
with the month & day in a numeric format.
Single digit days have to be managed as well
ServerName1_K044|0710
ServerName2_K044|1002 <-note: no "zero" in front of 2 above Oct 2
ServerName3_K044|0719
ServerName4_K044|0929
---------- Post updated at 04:20 PM ---------- Previous update was at 09:36 AM ----------
while read i
do
: whatever
done < list
When I tried this example, the program ran the first line as expected and did not advance to the second. Tried it with the ":" and without, same results.
while read i
do
: ans=`rexsh $i -l bozo -t10 uptime | cut -d" " -f6`
echo "$i|$ans" >>bootTimes.out
if [ $ans -ge 120 ]
then
echo "$i|$ans" >>bootThese.out
else
echo "$i|$ans" >>bootList2Recent2Work.out
fi