Move ramdisk backup/restore to tmpfs initskript

This commit is contained in:
Arne Fitzenreiter
2008-10-02 07:41:52 +02:00
parent d34d9f3b16
commit 1bc535b6c6
4 changed files with 19 additions and 18 deletions

View File

@@ -43,7 +43,7 @@ case "$1" in
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
@@ -54,17 +54,6 @@ case "$1" in
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
;;

View File

@@ -1,7 +1,6 @@
#!/bin/sh
# Begin $rc_base/init.d/tmpfs
. /etc/sysconfig/rc
. $rc_functions
@@ -13,17 +12,30 @@ fi
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