hotsanic |
Subversion Repositories: |
Compare with Previous - Blame - Download
#!/usr/bin/env sh
if ! [ -e settings ]; then OUTFILE="settings"; else OUTFILE="settings.new"; fi
cat > $OUTFILE << EOF
# You may configure partitions you would like to monitor.
# multiple lines are of course allowed.
#
# for a local drive enter:
# DRIVE=<device>,<description>
#
# for a remote (e.g. NFS or SNMP) drive enter:
# DRIVE=<server>:<path>,<description>
# DRIVE=SNMP:<host>:<community>:<device>,<description>
#
# Note: Be sure you have no '_' in host or community
# when using SNMP.
#
EOF
if [ "$OUTFILE" = "settings.new" ]; then
cat settings | grep "^DRIVE=" >> $OUTFILE
echo >> $OUTFILE
else
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
fi
echo
echo "Please check the settings file and adapt it to satisfy your needs."
if [ "$OUTFILE" = "settings.new" ]; then
mkdir -p backup
NOW=`date +%Y%m%d-%H%M%S`
mv -f settings backup/settings-$NOW
mv -f settings.new settings
echo "a backup of the previous settings has been saved."
fi
echo