Skip to content

Commit 1e0af8d

Browse files
committed
Bugfix in the installer and LSB compliant init script
1 parent 3b66b4b commit 1e0af8d

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

install

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

33
LOG_DIR=/var/log/netmeter
4+
INIT_RD_DIR=/etc/init.d
5+
INITSCRIPT=$INIT_RD_DIR/netmeter
46
echo "=================================================="
57
echo "Hello."
68
echo "Netmeter installation launched."
@@ -11,10 +13,14 @@ mkdir -vp $LOG_DIR
1113
chmod +x netmeter -v
1214
chmod -vR 0777 $LOG_DIR
1315

14-
ln -sv `pwd`/netmeter /etc/init.d/netmeter
16+
# ln -sv `pwd`/netmeter /etc/init.d/netmeter
17+
echo "PROGRAM="`pwd`/netmeter > $INITSCRIPT
18+
cat netmeter.initscript >> $INITSCRIPT
19+
update-rc.d -f netmeter remove
20+
update-rc.d netmeter start 90 2 3 4 5 .
1521

1622
echo "Installation finished. Netmeter will be started after reboot. If you want to run it now, execute the following line:"
1723
echo "/etc/init.d/netmeter &"
1824
echo "(note: netmeter would be closed if you close the console where you typed that line)"
1925
echo "Have a nice day."
20-
echo "=================================================="
26+
echo "=================================================="

netmeter.initscript

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
### BEGIN INIT INFO
2+
# Provides: Netmeter
3+
# Required-Start: $syslog
4+
# Required-Stop: $syslog
5+
# Default-Start: 2 3 4 5
6+
# Default-Stop:
7+
# Short-Description: Starts netmeter
8+
# Description: Enable service provided by daemon.
9+
### END INIT INFO
10+
11+
. /lib/lsb/init-functions
12+
13+
[ -f /etc/default/rcS ] && . /etc/default/rcS
14+
PATH=/bin:/usr/bin:/sbin:/usr/sbin
15+
16+
test -x $PROGRAM || exit 0
17+
18+
case "$1" in
19+
start)
20+
log_begin_msg "Launching netmeter"
21+
start-stop-daemon --start --pidfile /var/run/netmeter.pid --startas $PROGRAM &
22+
log_end_msg 0
23+
;;
24+
stop)
25+
;;
26+
force-reload|restart)
27+
$0 start
28+
;;
29+
status)
30+
exit 0
31+
;;
32+
*)
33+
log_success_msg "Usage: /etc/init.d/netmeter {start|restart|force-reload}"
34+
exit 1
35+
esac
36+
37+
exit 0

0 commit comments

Comments
 (0)