#vmstat command -free memory
vmstat 5 2|awk '{print $5}'|sort |head -n 1|xargs echo "Free Memory in Kbytes is"
Monday, July 26, 2010
Solaris vmstat command
Fields explained.
kthr || Report the number of kernel threads in each of the three following states:
r || the number of kernel threads in run queue
b || the number of blocked kernel threads that are waiting for
resources I/O, paging, and so forth
w || the number of swapped out light-weight processes (LWPs) that are
waiting for processing resources to finish.
swap || available swap space (Kbytes)
free || size of the free list (Kbytes)
Solaris prstat command
Solaris prstat
Fields explained.
PID :- The process ID of the process.
RSS :- The resident set size of the process
STATE:- The state of the process
PRI :- The priority of the process. Larger numbers mean higher
priority.
NICE :- Nice value used in priority computation.
CPU :- The percentage of recent CPU time used by the process.
Thursday, July 15, 2010
sed command - 's' for Subtitution.
--------------------------------
The most useful `sed` utility is s i think. ie subtitution.
Here is one example.
1)
+$ echo "dim" | sed s/dim/light/
light
+$
if the syntax is wrong;
+$ echo "dim" | sed s/dim/light
sed: command garbled: s/dim/light
2)
+$ cat file1
boy
+$ sed s/boy/girl/ file1 > file2
+$ cat file2
girl
---------------------------------------------------
The most useful `sed` utility is s i think. ie subtitution.
Here is one example.
1)
+$ echo "dim" | sed s/dim/light/
light
+$
if the syntax is wrong;
+$ echo "dim" | sed s/dim/light
sed: command garbled: s/dim/light
2)
+$ cat file1
boy
+$ sed s/boy/girl/ file1 > file2
+$ cat file2
girl
---------------------------------------------------
Wednesday, July 14, 2010
Network Link status Script
#!/bin/bash
#Scrit to check the link status.
#Date
date=`date |awk {'print $3"-"$2"-"$6"-"$4'}`
REPORT="/home/yourhome/network/report/report.log"
SUBJECT="Ping request fails on $date."
EMAILID="yourname@yourdomain.com"
EMAILFILE="/home/yourhome/network/email/email_file"
HOST="172.222.165.1"
#Ping to gateway.
COUNT=`ping -c 9 $HOST -w 10 |grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }'`
if [ $COUNT -gt 6 ]
then
echo "Link is up" >> /dev/null
exit 0
else
echo "Ping request failed on $date IST" >> $REPORT | mail -s "$SUBJECT" $EMAILID < $EMAILFILE
exit 1
fi
echo $?
#Scrit to check the link status.
#Date
date=`date |awk {'print $3"-"$2"-"$6"-"$4'}`
REPORT="/home/yourhome/network/report/report.log"
SUBJECT="Ping request fails on $date."
EMAILID="yourname@yourdomain.com"
EMAILFILE="/home/yourhome/network/email/email_file"
HOST="172.222.165.1"
#Ping to gateway.
COUNT=`ping -c 9 $HOST -w 10 |grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }'`
if [ $COUNT -gt 6 ]
then
echo "Link is up" >> /dev/null
exit 0
else
echo "Ping request failed on $date IST" >> $REPORT | mail -s "$SUBJECT" $EMAILID < $EMAILFILE
exit 1
fi
echo $?
Subscribe to:
Posts (Atom)