2019-05-10 11:17:57 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function menu {
|
2019-10-10 08:56:31 +08:00
|
|
|
clear
|
|
|
|
echo
|
|
|
|
echo -e "\t\tSys Admin Menu\n"
|
|
|
|
echo -e "\t1. Display disk space"
|
|
|
|
echo -e "\t2. Display logged on users"
|
|
|
|
echo -e "\t3. Display memory usage"
|
|
|
|
echo -e "\t0. Exit program\n\n"
|
|
|
|
echo -en "\t\tEnter option:"
|
|
|
|
read -n 1 option
|
2019-05-10 11:17:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function diskspace {
|
2019-10-10 08:56:31 +08:00
|
|
|
clear
|
|
|
|
df -k
|
2019-05-10 11:17:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function whoseon {
|
2019-10-10 08:56:31 +08:00
|
|
|
clear
|
|
|
|
who
|
2019-05-10 11:17:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function menusage {
|
2019-10-10 08:56:31 +08:00
|
|
|
clear
|
|
|
|
cat /proc/meminfo
|
2019-05-10 11:17:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
while [ 1 ]
|
|
|
|
do
|
2019-10-10 08:56:31 +08:00
|
|
|
menu
|
|
|
|
case $option in
|
|
|
|
0)
|
|
|
|
break ;;
|
|
|
|
1)
|
|
|
|
diskspace ;;
|
|
|
|
2)
|
|
|
|
whoseon ;;
|
|
|
|
3)
|
|
|
|
menusage ;;
|
|
|
|
*)
|
|
|
|
clear
|
|
|
|
echo "Sorry, wrong selection" ;;
|
|
|
|
esac
|
|
|
|
echo -en "\n\n\t\tHit any key to continue"
|
|
|
|
read -n 1 line
|
2019-05-10 11:17:57 +08:00
|
|
|
done
|
|
|
|
clear
|