mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-22 17:02:58 +02:00
Move ramdisk backup/restore to tmpfs initskript
This commit is contained in:
@@ -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
|
||||
;;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user