1 | 1 | simandl | #!/usr/bin/env sh |
2 | | | |
3 | | | if ! [ -e settings ]; then OUTFILE="settings"; else OUTFILE="settings.new"; fi |
4 | | | |
5 | | | |
6 | | | cat > $OUTFILE << EOF |
7 | | | # You may configure partitions you would like to monitor. |
8 | | | # multiple lines are of course allowed. |
9 | | | # |
10 | | | # for a local drive enter: |
11 | | | # DRIVE=<device>,<description> |
12 | | | # |
13 | | | # for a remote (e.g. NFS or SNMP) drive enter: |
14 | | | # DRIVE=<server>:<path>,<description> |
15 | | | # DRIVE=SNMP:<host>:<community>:<device>,<description> |
16 | | | # |
17 | | | # Note: Be sure you have no '_' in host or community |
18 | | | # when using SNMP. |
19 | | | # |
20 | | | EOF |
21 | | | |
22 | | | if [ "$OUTFILE" = "settings.new" ]; then |
23 | | | cat settings | grep "^DRIVE=" >> $OUTFILE |
24 | | | echo >> $OUTFILE |
25 | | | else |
26 | | | df|grep "^/"|grep -v proc|grep -v kern|grep -v above|grep -v volfs|awk '{ if ($6 == "/") { print "DRIVE="$1",root-filesystem"} else { print "DRIVE="$ 1","$6} }' >> $OUTFILE |
27 | | | fi |
28 | | | |
29 | | | echo |
30 | | | echo "Please check the settings file and adapt it to satisfy your needs." |
31 | | | if [ "$OUTFILE" = "settings.new" ]; then |
32 | | | mkdir -p backup |
33 | | | NOW=`date +%Y%m%d-%H%M%S` |
34 | | | mv -f settings backup/settings-$NOW |
35 | | | mv -f settings.new settings |
36 | | | echo "a backup of the previous settings has been saved." |
37 | | | fi |
38 | | | echo |
39 | | | |