Move vnstat database to /var/log/rrd
authorArne Fitzenreiter <arne_f@ipfire.org>
Wed, 1 Oct 2008 22:59:48 +0000 (00:59 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Wed, 1 Oct 2008 22:59:48 +0000 (00:59 +0200)
Add a tmpfs script to restore the ramdisk before network start and save after

config/rootfiles/common/initscripts
config/rootfiles/common/vnstat
config/rootfiles/updater/filelists/files
doc/packages-list.txt
lfs/initscripts
lfs/vnstat
src/initscripts/init.d/collectd
src/initscripts/init.d/tmpfs [new file with mode: 0644]

index f283431..f3ba875 100644 (file)
@@ -164,3 +164,7 @@ etc/sysconfig/firewall.local
 etc/sysconfig/modules
 etc/sysconfig/rc
 etc/sysconfig/rc.local
+etc/rc.d/init.d/tmpfs
+etc/rc.d/rc0.d/K85tmpfs
+etc/rc.d/rc3.d/S01tmpfs
+etc/rc.d/rc6.d/K85tmpfs
index 39def78..57c54db 100644 (file)
@@ -4,4 +4,3 @@ etc/vnstat.conf
 usr/bin/vnstat
 #usr/share/man/man1/vnstat.1
 #var/lib/vnstat
-var/log/vnstat
index aea3d85..0c95631 100644 (file)
@@ -8,6 +8,10 @@ etc/ppp/dialer
 etc/rc.d/init.d/checkfstab
 etc/rc.d/rcsysinit.d/S19checkfstab
 etc/rc.d/init.d/dhcp
+etc/rc.d/init.d/tmpfs
+etc/rc.d/rc0.d/K85tmpfs
+etc/rc.d/rc3.d/S01tmpfs
+etc/rc.d/rc6.d/K85tmpfs
 etc/rc.d/init.d/dnsmasq
 etc/rc.d/init.d/network
 etc/rc.d/init.d/networking/any
index d35e129..643e6d4 100644 (file)
 * linux-atm-2.4.1
 * linux-libc-headers-2.6.12.0
 * linuxigd-0.95
-* lm_sensors-3.0.2
+* lm_sensors-3.0.3
 * logrotate-3.7.1
 * logwatch-7.3.6
 * lsof-4.78
index 0249734..345a122 100644 (file)
@@ -129,6 +129,9 @@ $(TARGET) :
        ln -sf ../init.d/beep        /etc/rc.d/rc0.d/K99beep
        ln -sf ../init.d/beep        /etc/rc.d/rc3.d/S99beep
        ln -sf ../init.d/beep        /etc/rc.d/rc6.d/K99beep
+       ln -sf ../init.d/tmpfs       /etc/rc.d/rc0.d/K85tmpfs
+       ln -sf ../init.d/tmpfs       /etc/rc.d/rc3.d/S01tmpfs
+       ln -sf ../init.d/tmpfs       /etc/rc.d/rc6.d/K85tmpfs
 
        ln -sf ../init.d/mountkernfs /etc/rc.d/rcsysinit.d/S00mountkernfs
        ln -sf ../init.d/modules     /etc/rc.d/rcsysinit.d/S05modules
index b2a4c6e..2e7b46c 100644 (file)
@@ -76,7 +76,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        cd $(DIR_APP) && make $(MAKETUNING)                                                                             LOCAL_CONFIGURE_OPTIONS="--enable-readline=yes"
        cd $(DIR_APP) && make install
        sed -i 's|eth0|green0|g' /etc/vnstat.conf
-       sed -i 's|/var/lib/vnstat|/var/log/vnstat|g' /etc/vnstat.conf
-       -mkdir -p /var/log/vnstat
+       sed -i 's|/var/lib/vnstat|/var/log/rrd/vnstat|g' /etc/vnstat.conf
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
index 9857374..a64114f 100644 (file)
@@ -24,12 +24,6 @@ case "$1" in
                        fi
                fi
 
-               /etc/init.d/collectd restore
-
-               if [ ! -e $RRDLOG.bak/ ]; then
-                       mkdir $RRDLOG.bak/
-               fi
-
                boot_mesg -n "Loading Sensor Modules..."
                for modul in `cat /etc/sysconfig/lm_sensors | grep '^MODULE_' | cut -d"=" -s -f2`; do
                modprobe $modul > /dev/null 2>&1;
@@ -47,7 +41,10 @@ case "$1" in
                evaluate_retval
                ;;
        stop)
-               /etc/init.d/collectd backup
+               # Save the ramdisk at manual stop but not at shutdown
+               if [ "$(basename $0)" == "collectd" ]; then
+                   /etc/init.d/collectd backup
+               fi
                boot_mesg "Stopping Collection daemon..."
                killproc /usr/sbin/collectd
                evaluate_retval
diff --git a/src/initscripts/init.d/tmpfs b/src/initscripts/init.d/tmpfs
new file mode 100644 (file)
index 0000000..4a1ae15
--- /dev/null
@@ -0,0 +1,31 @@
+#!/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)
+               /etc/init.d/collectd restore
+               if [ ! -e $RRDLOG.bak/vnstat ]; then
+                       mkdir -p $RRDLOG.bak/vnstat
+               fi
+               ;;
+       stop)
+               /etc/init.d/collectd backup
+               ;;
+
+       *)
+               echo "Usage: $0 {start|stop}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/tmpfs