-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_func
More file actions
44 lines (39 loc) · 1015 Bytes
/
basic_func
File metadata and controls
44 lines (39 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/bash
# using zenity to create a menu
temp=$(mktemp -t temp.XXXXXX)
temp2=$(mktemp -t temp2.XXXXXX)
function diskspace {
df -k > $temp
zenity --text-info --title "Disk Space" --filename=$temp --width 750 --height 10
}
function whoseon {
who > $temp
zenity --text-info --title "Logged in users" --filename=$temp --width 500 --height 10
}
function memusage {
cat /proc/meminfo > $temp
zenity --text-info --title "Memory Usage" --filename=$temp --width 300 --height 500
}
while [ 1 ]
do
zenity --list --radiolist --title "Sys Admin Menu" --column "Select" --column "Menu Item" FALSE "Display diskspace" FALSE "Display users" FALSE "Display memory usage" FALSE "Exit" > $temp2
if [ $? -eq 1 ]
then
break
fi
selection=$(cat $temp2)
case $selection in
"Display diskspace")
diskspace;;
"Display users")
whoseon;;
"Display memory usage")
memusage;;
"Exit")
break;;
*)
zenity --info "Sory, Wrong Selection"
esac
done
rm -f $temp 2> /dev/null
rm -f $temp2 2> /dev/null