summaryrefslogtreecommitdiff
path: root/network/vnstat/rc.vnstat
diff options
context:
space:
mode:
authorMichiel van Wessem <michiel@slackbuilds.org>2011-03-02 20:52:07 -0300
committerNiels Horn <niels.horn@slackbuilds.org>2011-03-02 20:52:07 -0300
commit79a55aefe30b0e8d50b1b2724a7fd78d4c2437d3 (patch)
tree87a74e1ea97de53467cabbaa8094349c1208dfc5 /network/vnstat/rc.vnstat
parent419ccb1bc0d955776bf7c2008df3b6f387e00518 (diff)
downloadslackbuilds-79a55aefe30b0e8d50b1b2724a7fd78d4c2437d3.tar.gz
network/vnstat: Fixed code in rc.vnstat
Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
Diffstat (limited to 'network/vnstat/rc.vnstat')
-rw-r--r--network/vnstat/rc.vnstat44
1 files changed, 25 insertions, 19 deletions
diff --git a/network/vnstat/rc.vnstat b/network/vnstat/rc.vnstat
index bb9e948c02..e17d7cdeeb 100644
--- a/network/vnstat/rc.vnstat
+++ b/network/vnstat/rc.vnstat
@@ -43,6 +43,15 @@ vnstat_stop() {
fi
}
+vnstat_status() {
+ pid="$(pidof $1)"
+ if [ -n "$pid" ]; then
+ echo "vnstat daemon is running with pid $pid"
+ else
+ echo "vnstat daemon is not running."
+ fi
+}
+
vnstat_restart() {
echo "restarting the vnstart daemon..."
vnstat_stop
@@ -50,24 +59,21 @@ vnstat_restart() {
vnstat_start
}
-
case "$1" in
- 'start')
- vnstat_start
- ;;
- 'stop')
- vnstat_stop
- ;;
- 'restart','reload')
- vnstat_restart
- ;;
- 'status')
- vnstat_status
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|reload|status}"
- exit 1
- ;;
+ 'start')
+ vnstat_start
+ ;;
+ 'stop')
+ vnstat_stop
+ ;;
+ 'restart'|'reload')
+ vnstat_restart
+ ;;
+ 'status')
+ vnstat_status vnstatd
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload|status}"
+ exit 1
+ ;;
esac
-
-