]>
Commit | Line | Data |
---|---|---|
c4a451ee AM |
1 | #!/bin/sh |
2 | # Begin $rc_base/init.d/vnstat | |
3 | ||
4 | . /etc/sysconfig/rc | |
5 | . $rc_functions | |
6 | ||
7 | eval $(/usr/local/bin/readhash /var/ipfire/main/settings) | |
8 | ||
9 | if [ "$VNSTATLOG" = '' ]; then | |
10 | VNSTATLOG=/var/log/vnstat | |
11 | fi | |
12 | ||
13 | case "$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 | |
c4a451ee | 23 | ;; |
5a5de3f0 | 24 | |
c4a451ee | 25 | stop) |
5a5de3f0 MF |
26 | boot_mesg "Stopping vnstatd..." |
27 | killproc /usr/sbin/vnstatd | |
5a5de3f0 MF |
28 | evaluate_retval |
29 | ||
6146d190 | 30 | umount_ramdisk "${VNSTATLOG}" |
49d09728 | 31 | boot_mesg "Unmounting vnstat ramdisk..." |
c4a451ee | 32 | ;; |
5a5de3f0 | 33 | |
d2738c4c MU |
34 | restart) |
35 | ${0} stop | |
36 | sleep 1 | |
37 | ${0} start | |
38 | ;; | |
5a5de3f0 | 39 | |
51044e04 MF |
40 | status) |
41 | statusproc /usr/sbin/vnstatd | |
42 | ;; | |
43 | ||
08729f79 MT |
44 | backup) |
45 | # Backup all data if ramdisk is used | |
46 | if mountpoint "${RRDLOG}" &>/dev/null; then | |
47 | ${0} restart | |
48 | fi | |
49 | ;; | |
50 | ||
c4a451ee | 51 | *) |
51044e04 | 52 | echo "Usage: $0 {start|stop|restart|status|backup}" |
c4a451ee AM |
53 | exit 1 |
54 | ;; | |
55 | esac | |
56 | ||
57 | # End $rc_base/init.d/vnstat |