1 Index: new/ksmtuned.init
2 ===================================================================
3 --- new.orig/ksmtuned.init 2011-06-14 05:58:03.000000000 +0200
4 +++ new/ksmtuned.init 2011-06-14 06:01:38.000000000 +0200
9 -# Default-Start: 3 4 5
10 +# Default-Start: 2 3 4 5
11 +# Default-Stop: 0 1 6
12 # Short-Description: tune the speed of ksm
13 # Description: The Kernel Samepage Merging control Daemon is a simple script
14 # that controls whether (and with what vigor) should ksm search duplicated
16 # needs testing and ironing. contact danken@redhat.com if something breaks.
19 -. /etc/rc.d/init.d/functions
20 +. /lib/lsb/init-functions
22 +PATH=/sbin:/bin:/usr/sbin:/usr/bin
25 ksmtuned=/usr/sbin/ksmtuned
26 +DESC="KSM control daemon"
28 pidfile=${PIDFILE-/var/run/ksmtune.pid}
31 +test -x $ksmtuned || exit 0
33 +# Include defaults if available
34 +if [ -f /etc/default/$prog ] ; then
35 + . /etc/default/$prog
38 +if [ "$START" != "yes" ]; then
43 - echo -n $"Starting $prog: "
44 - daemon --pidfile=${pidfile} $ksmtuned
46 + [ -d /sys/kernel/mm/ksm/ ] || exit 0;
48 + log_daemon_msg "Starting $DESC" $prog
49 + pid=$( pidofproc -p ${pidfile} $ksmtuned )
50 + if [ -n "$pid" ] ; then
51 + log_begin_msg "Already running."
56 + start-stop-daemon --start --quiet --pidfile=${pidfile} --exec $ksmtuned
59 - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
64 - echo -n $"Stopping $prog: "
65 - killproc -p ${pidfile}
66 + log_daemon_msg "Stopping $DESC" $prog
67 + start-stop-daemon --stop --quiet --pidfile ${pidfile}
70 - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
80 - [ -e /var/lock/subsys/$prog ] && restart || :
90 - status -p ${pidfile} $prog
92 + pidofproc -p ${pidfile} $ksmtuned >/dev/null
94 + if [ $RETVAL -eq 0 ]; then
95 + log_success_msg "$DESC is running."
97 + log_failure_msg "$DESC is not running."
100 restart|force-reload)
103 - condrestart|try-restart)
107 - pid=`cat ${pidfile} 2> /dev/null`
109 - if [ -z "$pid" ]; then
110 - echo $"Cannot retune, service is not running."
113 + pid=$( pidofproc -p ${pidfile} $ksmtuned )
114 + if [ -n "$pid" ] ; then
119 + log_failure_msg "$DESC is not running."
123 - echo $"Usage: $prog {start|stop|restart|force-reload|condrestart|try-restart|status|retune|help}"
124 + echo $"Usage: $prog {start|stop|restart|force-reload|status|reload|help}"