# Make some nice graphs
*/5 * * * * /usr/local/bin/makegraphs >/dev/null
-* 05 * * * /etc/init.d/collectd backup >/dev/null
+* 05 * * * /etc/init.d/tmpfs backup >/dev/null
# Force update the dynamic dns registration once a week
# Force update even if IP has not changed once a month if 'minimize update' selected in GUI
#
grep -v "ipacsum" /var/spool/cron/root.orig | grep -v "hddshutdown" > /tmp/root.orig.tmp
echo "# Backup collectd files" >> /tmp/root.orig.tmp
-echo "* 05 * * * /etc/init.d/collectd backup >/dev/null" >> /tmp/root.orig.tmp
+echo "* 05 * * * /etc/init.d/tmpfs backup >/dev/null" >> /tmp/root.orig.tmp
echo "# hddshutdown" >> /tmp/root.orig.tmp
echo "*/30 * * * * /usr/local/bin/hddshutdown >/dev/null" >> /tmp/root.orig.tmp
mv /tmp/root.orig.tmp /var/spool/cron/root.orig
stop)
# Save the ramdisk at manual stop but not at shutdown
if [ "$(basename $0)" == "collectd" ]; then
- /etc/init.d/collectd backup
+ /etc/init.d/tmpfs backup
fi
boot_mesg "Stopping Collection daemon..."
killproc /usr/sbin/collectd
sleep 1
${0} start
;;
- backup)
- boot_mesg "Save rrd files from ramd..."
- cp -pR $RRDLOG/* $RRDLOG.bak/
- evaluate_retval
- ;;
- restore)
- if [ -e $RRDLOG.bak ];then
- boot_mesg "Copying rrd files to ramd..."
- cp -pR $RRDLOG.bak/* $RRDLOG/
- fi
- ;;
status)
statusproc /usr/sbin/collectd
;;
#!/bin/sh
# Begin $rc_base/init.d/tmpfs
-
. /etc/sysconfig/rc
. $rc_functions
case "$1" in
start)
- /etc/init.d/collectd restore
+ $0 restore
if [ ! -e $RRDLOG.bak/vnstat ]; then
mkdir -p $RRDLOG.bak/vnstat
fi
;;
stop)
- /etc/init.d/collectd backup
+ $0 backup
+ ;;
+
+ backup)
+ boot_mesg "Save ramdisk..."
+ cp -pR $RRDLOG/* $RRDLOG.bak/
+ evaluate_retval
;;
+ restore)
+ if [ -e $RRDLOG.bak ];then
+ boot_mesg "Restore ramdisk..."
+ cp -pR $RRDLOG.bak/* $RRDLOG/
+ fi
+ ;;
+
*)
- echo "Usage: $0 {start|stop}"
+ echo "Usage: $0 {start|stop|backup}"
exit 1
;;
esac