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

@@ -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