qemu/ksmtuned.init
Mark McLoughlin cd8d5cb64c - Add ksmtuned, also from Dan Kenigsberg
- Use %_initddir macro
2009-09-16 17:31:15 +00:00

84 lines
1.6 KiB
Bash

#!/bin/bash
#
# ksmtuned Kernel Samepage Merging (KSM) Tuning Daemon
#
# Author: Dan Kenigsberg <danken@redhat.com>
#
# Copyright 2009 Red Hat, Inc. and/or its affiliates.
# Released under the GPL
#
# chkconfig: - 85 15
# description: The KSM tuning daemon controls whether (and with what vigor) \
# ksm should ksm search duplicated pages.
# processname: ksmtuned
# config: /etc/ksmtuned.conf
# pidfile: /var/run/ksmtuned.pid
#
### BEGIN INIT INFO
# Provides: ksmtuned
# Required-Start:
# Required-Stop:
# Should-Start:
# Short-Description: tune the speed of ksm
# Description: The Kernel Samepage Merging control Daemon is a simple script
# that controls whether (and with what vigor) should ksm search duplicated
# memory pages.
# needs testing and ironing. contact danken@redhat.com if something breaks.
### END INIT INFO
. /etc/rc.d/init.d/functions
prog=ksmtuned
ksmtuned=/usr/sbin/ksmtuned
pidfile=${PIDFILE-/var/run/ksmtune.pid}
RETVAL=0
start() {
echo -n $"Starting $prog: "
daemon --pidfile=${pidfile} $ksmtuned
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
}
restart() {
stop
start
}
condrestart() {
[ -e /var/lock/subsys/$prog ] && restart || :
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $prog
RETVAL=$?
;;
restart)
restart
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|status|help}"
RETVAL=3
esac
exit $RETVAL