|
#!/bin/bash
# vlinkstatus-1.2.sh
TMPFILE="/tmp/.tmp_vlinkstatus.txt"
write_it () {
echo "" >> $TMPFILE
date +%F_%T >> $TMPFILE && echo "Write date information."
netstat -4 -natup >> $TMPFILE && echo "Write state information."
}
clear_it () {
rm -f $TMPFILE
}
# The first position parameter of the function is the second position
# parameter of the script.
# position parameter - show a few records, values allow 1,2,3.
# default is 1.
read_itTail () {
declare tmp_datestamp=""
declare -i k=1
case $1 in
2)
k=2
;;
3)
k=3
;;
*)
k=1
;;
esac
tmp_datestamp="`vlinkstatus -a | grep "^[[:digit:]]\{4\}" | tail -$k | head -1`"
sed -n '/'$tmp_datestamp'/,/$$/p' $TMPFILE
}
read_itAll () {
cat $TMPFILE 2> /dev/null
}
edit_tmpFile () {
vim $TMPFILE
}
view_version () {
sed -n '/vlinkstatus/p' $0 | sed -n '1p' | cut -d# -f2
}
view_help () {
cat |
|
|