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
11 +# Required-Start: $remote_fs
12 +# Required-Stop: $remote_fs
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
21 # needs testing and ironing. contact danken@redhat.com if something breaks.
24 -. /etc/rc.d/init.d/functions
25 +. /lib/lsb/init-functions
27 +PATH=/sbin:/bin:/usr/sbin:/usr/bin
30 ksmtuned=/usr/sbin/ksmtuned
31 +DESC="KSM control daemon"
33 pidfile=${PIDFILE-/var/run/ksmtune.pid}
36 +test -x $ksmtuned || exit 0
38 +# Include defaults if available
39 +if [ -f /etc/default/$prog ] ; then
40 + . /etc/default/$prog
43 +if [ "$START" != "yes" ]; then
48 - echo -n $"Starting $prog: "
49 - daemon --pidfile=${pidfile} $ksmtuned
51 + [ -d /sys/kernel/mm/ksm/ ] || exit 0;
53 + log_daemon_msg "Starting $DESC" $prog
54 + pid=$( pidofproc -p ${pidfile} $ksmtuned )
55 + if [ -n "$pid" ] ; then
56 + log_begin_msg "Already running."
61 + start-stop-daemon --start --quiet --pidfile=${pidfile} --exec $ksmtuned
64 - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
69 - echo -n $"Stopping $prog: "
70 - killproc -p ${pidfile}
71 + log_daemon_msg "Stopping $DESC" $prog
72 + start-stop-daemon --stop --quiet --pidfile ${pidfile}
75 - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
85 - [ -e /var/lock/subsys/$prog ] && restart || :
95 - status -p ${pidfile} $prog
97 + pidofproc -p ${pidfile} $ksmtuned >/dev/null
99 + if [ $RETVAL -eq 0 ]; then
100 + log_success_msg "$DESC is running."
102 + log_failure_msg "$DESC is not running."
105 restart|force-reload)
108 - condrestart|try-restart)
112 - pid=`cat ${pidfile} 2> /dev/null`
114 - if [ -z "$pid" ]; then
115 - echo $"Cannot retune, service is not running."
118 + pid=$( pidofproc -p ${pidfile} $ksmtuned )
119 + if [ -n "$pid" ] ; then
124 + log_failure_msg "$DESC is not running."
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}"