#!/bin/sh
# Begin $rc_base/init.d/collecd
-
. /etc/sysconfig/rc
. $rc_functions
case "$1" in
start)
+ if use_ramdisk; then
+ boot_mesg "Mounting RRD ramdisk..."
+ mount_ramdisk "${RRDLOG}"
+ evaluate_retval
+ fi
+
# If run from init and collectd alrady started then exit silent
if [ "$(basename $0)" != "collectd" ]; then
if [ "$(ps -A | grep " collectd$")" != "" ]; then
boot_mesg "Stopping Collection daemon..."
killproc /usr/sbin/collectd
evaluate_retval
- # Save the ramdisk at manual stop but not at shutdown
- if [ "$(basename $0)" == "collectd" ]; then
- /etc/init.d/tmpfs backup
- fi
- # sync after backup...
- sync
+
+ # Umount the ramdisk (if any)
+ umount_ramdisk "${RRDLOG}"
;;
restart)
${0} stop
statusproc /usr/sbin/collectd
;;
+ backup)
+ # Backup all data if ramdisk is used
+ if mountpoint "${RRDLOG}" &>/dev/null; then
+ ${0} restart
+ fi
+ ;;
+
*)
- echo "Usage: $0 {start|stop|restart|status}"
+ echo "Usage: $0 {start|stop|restart|status|backup}"
exit 1
;;
esac