]> git.proxmox.com Git - ksm-control-daemon.git/blob - debian/patches/init-script.diff
fix lintian warning
[ksm-control-daemon.git] / debian / patches / init-script.diff
1 Index: new/ksmtuned.init
2 ===================================================================
3 --- new.orig/ksmtuned.init 2011-09-23 12:11:48.000000000 +0200
4 +++ new/ksmtuned.init 2011-09-23 12:13:29.000000000 +0200
5 @@ -16,10 +16,11 @@
6 #
7 ### BEGIN INIT INFO
8 # Provides: ksmtuned
9 -# Required-Start:
10 -# Required-Stop:
11 +# Required-Start: $remote_fs
12 +# Required-Stop: $remote_fs
13 # Should-Start:
14 -# Default-Start: 3 4 5
15 +# Default-Start: 2 3 4 5
16 +# Default-Stop: 0 1 6
17 # Short-Description: tune the speed of ksm
18 # Description: The Kernel Samepage Merging control Daemon is a simple script
19 # that controls whether (and with what vigor) should ksm search duplicated
20 @@ -27,27 +28,50 @@
21 # needs testing and ironing. contact danken@redhat.com if something breaks.
22 ### END INIT INFO
23
24 -. /etc/rc.d/init.d/functions
25 +. /lib/lsb/init-functions
26 +
27 +PATH=/sbin:/bin:/usr/sbin:/usr/bin
28
29 prog=ksmtuned
30 ksmtuned=/usr/sbin/ksmtuned
31 +DESC="KSM control daemon"
32 +
33 pidfile=${PIDFILE-/var/run/ksmtune.pid}
34 RETVAL=0
35
36 +test -x $ksmtuned || exit 0
37 +
38 +# Include defaults if available
39 +if [ -f /etc/default/$prog ] ; then
40 + . /etc/default/$prog
41 +fi
42 +
43 +if [ "$START" != "yes" ]; then
44 + exit 0
45 +fi
46 +
47 start() {
48 - echo -n $"Starting $prog: "
49 - daemon --pidfile=${pidfile} $ksmtuned
50 +
51 + [ -d /sys/kernel/mm/ksm/ ] || exit 0;
52 +
53 + log_daemon_msg "Starting $DESC" $prog
54 + pid=$( pidofproc -p ${pidfile} $ksmtuned )
55 + if [ -n "$pid" ] ; then
56 + log_begin_msg "Already running."
57 + log_end_msg 0
58 + exit 0
59 + fi
60 +
61 + start-stop-daemon --start --quiet --pidfile=${pidfile} --exec $ksmtuned
62 RETVAL=$?
63 - echo
64 - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
65 + log_end_msg $RETVAL
66 }
67
68 stop() {
69 - echo -n $"Stopping $prog: "
70 - killproc -p ${pidfile}
71 + log_daemon_msg "Stopping $DESC" $prog
72 + start-stop-daemon --stop --quiet --pidfile ${pidfile}
73 RETVAL=$?
74 - echo
75 - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
76 + log_end_msg $RETVAL
77 }
78
79 restart() {
80 @@ -55,10 +79,6 @@
81 start
82 }
83
84 -condrestart() {
85 - [ -e /var/lock/subsys/$prog ] && restart || :
86 -}
87 -
88 case "$1" in
89 start)
90 start
91 @@ -67,27 +87,28 @@
92 stop
93 ;;
94 status)
95 - status -p ${pidfile} $prog
96 - RETVAL=$?
97 + pidofproc -p ${pidfile} $ksmtuned >/dev/null
98 + RETVAL=$?
99 + if [ $RETVAL -eq 0 ]; then
100 + log_success_msg "$DESC is running."
101 + else
102 + log_failure_msg "$DESC is not running."
103 + fi
104 ;;
105 restart|force-reload)
106 restart
107 ;;
108 - condrestart|try-restart)
109 - condrestart
110 - ;;
111 - retune)
112 - pid=`cat ${pidfile} 2> /dev/null`
113 - RETVAL=$?
114 - if [ -z "$pid" ]; then
115 - echo $"Cannot retune, service is not running."
116 - else
117 + reload)
118 + pid=$( pidofproc -p ${pidfile} $ksmtuned )
119 + if [ -n "$pid" ] ; then
120 kill -SIGUSR1 $pid
121 RETVAL=$?
122 - fi
123 + else
124 + log_failure_msg "$DESC is not running."
125 + fi
126 ;;
127 *)
128 - echo $"Usage: $prog {start|stop|restart|force-reload|condrestart|try-restart|status|retune|help}"
129 + echo $"Usage: $prog {start|stop|restart|force-reload|status|reload|help}"
130 RETVAL=2
131 esac
132