mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-16 14:03:00 +02:00
44 lines
632 B
Bash
44 lines
632 B
Bash
#!/bin/sh
|
|
# Begin $rc_base/init.d/tmpfs
|
|
|
|
. /etc/sysconfig/rc
|
|
. $rc_functions
|
|
|
|
eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
|
|
|
|
if [ "$RRDLOG" = '' ]; then
|
|
RRDLOG=/var/log/rrd
|
|
fi
|
|
|
|
case "$1" in
|
|
start)
|
|
$0 restore
|
|
if [ ! -e $RRDLOG.bak/vnstat ]; then
|
|
mkdir -p $RRDLOG.bak/vnstat
|
|
fi
|
|
;;
|
|
stop)
|
|
$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|backup}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# End $rc_base/init.d/tmpfs
|