<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<font size="-1"><font face="Verdana">I've also un-nested the if
statement. Complete init script:<br>
<br>
#!/bin/bash<br>
#<br>
# ksmtuned Kernel Samepage Merging (KSM) Tuning Daemon<br>
#<br>
# Author: Dan Kenigsberg <a class="moz-txt-link-rfc2396E" href="mailto:danken@redhat.com"><danken@redhat.com></a><br>
#<br>
# Copyright 2009 Red Hat, Inc. and/or its affiliates.<br>
# Released under the GPL<br>
#<br>
# chkconfig: 345 85 15<br>
# description: The KSM tuning daemon controls whether (and with what
vigor) \<br>
# ksm should ksm search duplicated pages.<br>
# processname: ksmtuned<br>
# config: /etc/ksmtuned.conf<br>
# pidfile: /var/run/ksmtuned.pid<br>
#<br>
### BEGIN INIT INFO<br>
# Provides: ksmtuned<br>
# Required-Start:<br>
# Required-Stop:<br>
# Should-Start:<br>
# Default-Start: 3 4 5<br>
# Default-Stop: 0 1 6<br>
# Short-Description: tune the speed of ksm<br>
# Description: The Kernel Samepage Merging control Daemon is a simple
script<br>
# that controls whether (and with what vigor) should ksm search
duplicated<br>
# memory pages.<br>
# needs testing and ironing. contact <a class="moz-txt-link-abbreviated" href="mailto:danken@redhat.com">danken@redhat.com</a> if something
breaks.<br>
### END INIT INFO<br>
<br>
. /lib/lsb/init-functions<br>
<br>
PATH=/sbin:/bin:/usr/sbin:/usr/bin<br>
<br>
prog=ksmtuned<br>
ksmtuned=/usr/sbin/ksmtuned<br>
DESC="KSM control daemon"<br>
<br>
pidfile=${PIDFILE-/var/run/ksmtune.pid}<br>
RETVAL=0<br>
<br>
test -x $ksmtuned || exit 0<br>
<br>
#Include defaults if available<br>
if [ -f /etc/defaults/$prog ] ; then<br>
. /etc/defaults/$prog<br>
fi<br>
<br>
if [ "$START" != "yes" ]; then<br>
exit 0<br>
fi<br>
<br>
start() {<br>
<br>
[ -d /sys/kernel/mm/ksm/ ] || exit 0;<br>
<br>
log_daemon_msg "Starting $DESC" $prog<br>
pid=$( pidofproc -p ${pidfile} $ksmtuned )<br>
if [ -n "$pid" ] ; then<br>
log_begin_msg "Already running."<br>
log_end_msg 0<br>
exit 0<br>
fi<br>
<br>
start-stop-daemon --start --quiet --pidfile=${pidfile} --exec
$ksmtuned<br>
RETVAL=$?<br>
log_end_msg $RETVAL<br>
}<br>
<br>
stop() {<br>
log_daemon_msg "Stopping $DESC" $prog<br>
start-stop-daemon --stop --quiet --pidfile ${pidfile}<br>
RETVAL=$?<br>
log_end_msg $RETVAL<br>
}<br>
<br>
restart() {<br>
stop<br>
start<br>
}<br>
<br>
case "$1" in<br>
start)<br>
start<br>
;;<br>
stop)<br>
stop<br>
;;<br>
status)<br>
pidofproc -p ${pidfile} $ksmtuned >/dev/null<br>
RETVAL=$?<br>
if [ $RETVAL -eq 0 ]; then<br>
log_success_msg "$DESC is running."<br>
else<br>
log_failure_msg "$DESC is not running."<br>
fi<br>
;;<br>
restart)<br>
restart<br>
;;<br>
force-reload)<br>
restart<br>
;;<br>
reload)<br>
kill -SIGUSR1 `cat ${pidfile}`<br>
RETVAL=$?<br>
;;<br>
*)<br>
echo $"Usage: $prog
{start|stop|restart|force-restart|status|reload}"<br>
RETVAL=3<br>
esac<br>
<br>
exit $RETVAL<br>
<br>
<br>
</font></font><br>
-------- Original Message --------<br>
Subject: Re: [PVE-User] KSM not working?<br>
From: Fred Supinski <a class="moz-txt-link-rfc2396E" href="mailto:fred@vmu.ca"><fred@vmu.ca></a><br>
To: <a class="moz-txt-link-abbreviated" href="mailto:pve-user@pve.proxmox.com">pve-user@pve.proxmox.com</a><br>
Date: Wed Dec 30 2009 03:21:16 GMT-0500 (Eastern Standard Time)<br>
<blockquote cite="mid:4B3B0D7C.3050507@vmu.ca" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
<font size="-1"><font face="Verdana">The path is hard coded wrong
also.<br>
<br>
/etc/default/$prog needs to be changed to /etc/defaults/$prog<br>
<br>
I think that pretty much covers off the init script.<br>
<br>
-Fred<br>
</font></font><br>
-------- Original Message --------<br>
Subject: Re: [PVE-User] KSM not working?<br>
From: Dietmar Maurer <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E" href="mailto:dietmar@proxmox.com"><dietmar@proxmox.com></a><br>
To: Fred Supinski <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E" href="mailto:fred@vmu.ca"><fred@vmu.ca></a>,
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:pve-user@pve.proxmox.com">pve-user@pve.proxmox.com</a>
<a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="mailto:pve-user@pve.proxmox.com"><pve-user@pve.proxmox.com></a><br>
Date: Wed Dec 30 2009 02:57:54 GMT-0500 (Eastern Standard Time)<br>
<blockquote cite="mid:4B3B09E9.702@vmu.ca" type="cite">
<pre wrap="">The statement should then be nested in the if statement that is loading
that file, shouldn't it?
#Include defaults if available
if [ -f /etc/default/$prog ] ; then
. /etc/default/$prog
if [ "$START" != "yes" ]; then
exit 0
fi
fi
-Fred
-------- Original Message --------
Subject: Re: [PVE-User] KSM not working?
From: Dietmar Maurer <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E" href="mailto:dietmar@proxmox.com"><dietmar@proxmox.com></a>
To: Fred Supinski <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E" href="mailto:fred@vmu.ca"><fred@vmu.ca></a>, <a
moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:pve-user@pve.proxmox.com">pve-user@pve.proxmox.com</a>
<a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="mailto:pve-user@pve.proxmox.com"><pve-user@pve.proxmox.com></a>
Date: Wed Dec 30 2009 02:57:54 GMT-0500 (Eastern Standard Time)
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">I'm not sure about the if statement though. Where is this variable being pulled from?
</pre>
</blockquote>
<pre wrap="">from /etc/defaults/ksmtuned
- Dietmar
</pre>
</blockquote>
<pre wrap="">_______________________________________________
pve-user mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:pve-user@pve.proxmox.com">pve-user@pve.proxmox.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-user">http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-user</a>
</pre>
</blockquote>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
pve-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:pve-user@pve.proxmox.com">pve-user@pve.proxmox.com</a>
<a class="moz-txt-link-freetext" href="http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-user">http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-user</a>
</pre>
</blockquote>
<br>
</body>
</html>