Graphic_Of_System_Usage
{
set -A resources user1 user2 user3 user4 user5 user6 user7 user8
for Q in $(echo ${resources[*]})
do
rm /tmp/resource.usage
last | grep $(date +%h) | grep $Q | awk '{print $9}' | grep '(' | sed 's/(//g' | sed 's/)//g' | sed 's/:/ /g' > /tmp/resource.usage
USAGE=0
CHART=0
J=0
while read MIN SEC
do
(( TMIN = MIN * 60 ))
(( TSEC = TMIN + SEC ))
(( USAGE = $USAGE + $TSEC ))
done < /tmp/resource.usage
(( CHART = $USAGE / 100 ))
echo "$Q: \c"
while [ $J -lt $CHART ]
do
echo "|\c"
(( J = $J +1 ))
done
echo "\n"
done
}
{
set -A resources user1 user2 user3 user4 user5 user6 user7 user8
for Q in $(echo ${resources[*]})
do
rm /tmp/resource.usage
last | grep $(date +%h) | grep $Q | awk '{print $9}' | grep '(' | sed 's/(//g' | sed 's/)//g' | sed 's/:/ /g' > /tmp/resource.usage
USAGE=0
CHART=0
J=0
while read MIN SEC
do
(( TMIN = MIN * 60 ))
(( TSEC = TMIN + SEC ))
(( USAGE = $USAGE + $TSEC ))
done < /tmp/resource.usage
(( CHART = $USAGE / 100 ))
echo "$Q: \c"
while [ $J -lt $CHART ]
do
echo "|\c"
(( J = $J +1 ))
done
echo "\n"
done
}
you will see something like this.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.