]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/initscripts/system/vnstat
vnstat 2.6: Added status section for initscript
[people/pmueller/ipfire-2.x.git] / src / initscripts / system / vnstat
CommitLineData
c4a451ee
AM
1#!/bin/sh
2# Begin $rc_base/init.d/vnstat
3
4. /etc/sysconfig/rc
5. $rc_functions
6
7eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
8
9if [ "$VNSTATLOG" = '' ]; then
10 VNSTATLOG=/var/log/vnstat
11fi
12
13case "$1" in
14 start)
ee3dec50 15 if use_ramdisk; then
6146d190
MT
16 boot_mesg "Mounting vnstat ramdisk..."
17 mount_ramdisk "${VNSTATLOG}"
18 evaluate_retval
c4a451ee 19 fi
5a5de3f0
MF
20
21 boot_mesg "Starting vnstatd..."
22 loadproc /usr/sbin/vnstatd -d --alwaysadd
5a5de3f0 23 evaluate_retval
c4a451ee 24 ;;
5a5de3f0 25
c4a451ee 26 stop)
5a5de3f0
MF
27 boot_mesg "Stopping vnstatd..."
28 killproc /usr/sbin/vnstatd
5a5de3f0
MF
29 evaluate_retval
30
6146d190 31 umount_ramdisk "${VNSTATLOG}"
49d09728
MF
32 boot_mesg "Unmounting vnstat ramdisk..."
33 evaluate_retval
c4a451ee 34 ;;
5a5de3f0 35
d2738c4c
MU
36 restart)
37 ${0} stop
38 sleep 1
39 ${0} start
40 ;;
5a5de3f0 41
51044e04
MF
42 status)
43 statusproc /usr/sbin/vnstatd
44 ;;
45
08729f79
MT
46 backup)
47 # Backup all data if ramdisk is used
48 if mountpoint "${RRDLOG}" &>/dev/null; then
49 ${0} restart
50 fi
51 ;;
52
c4a451ee 53 *)
51044e04 54 echo "Usage: $0 {start|stop|restart|status|backup}"
c4a451ee
AM
55 exit 1
56 ;;
57esac
58
59# End $rc_base/init.d/vnstat