-
Notifications
You must be signed in to change notification settings - Fork 0
/
iter7
executable file
·65 lines (54 loc) · 1012 Bytes
/
iter7
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# sysinfo_page - A script to provide system infromaation in html
#### Variables
title="System information for $HOSTNAME"
RIGHT_NOW=$(date +"%r %x %Z")
TIME_STAMP="Last updated on $RIGHT_NOW"
#### Functions
system_info()
{
echo "<h2>System release info</h2>"
echo "<p>Function not yet implemented</p>"
}
show_uptime()
{
echo "<h2>System uptime</h2>"
echo "<pre>"
uptime
echo "</pre>"
}
drive_space()
{
echo "<h2>Filesystem space</h2>"
echo "<pre>"
df -h
echo "</pre>"
}
home_space()
{
# Only superuser shoult execute this
if [ $(id -u) = "0" ]; then
echo "<h2>Home directory pace used by user</h2>"
echo "<pre>"
du -s /home/* | sort -nr
echo "</pre>"
fi
}
#### Main
cat <<- _EOF_
<html>
<head>
<title>
$title $HOSTNAME
</title>
</head>
<body>
$title
<p>$TIME_STAMP</p>
$(system_info)
$(show_uptime)
$(drive_space)
$(home_space)
</body>
</html>
_EOF_