<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I did not actually test <i>restart,</i> but I did a <i>start</i> on a running client and it said <br><br><font style="" color="#5133AB">Xymon client already running, re-starting it</font><br><br>and it seemed to actually successfully stop and start the client. (Timestamp on ps changed)<br><br>So I was thinking that a restart would work because start does it's own restart.  <br><br>Which was not what I was expecting when I ran "start", but it was not a bad surprise. I contemplated if I could use start for stop ... but nope, that was not going to do what I needed!<br><br>In my own code fix, I fixed restart as well / the same way as stop. But I thought best to be conservative with a public posting :)<br><br>Bakkies<br><br><br><br><br><div><hr id="stopSpelling">From: jlaidman@rebel-it.com.au<br>Date: Wed, 25 Sep 2013 11:02:40 +1000<br>Subject: Re: [Xymon] xymon-client startup script issue (and fix)<br>To: bakgat8@hotmail.com<br>CC: xymon@xymon.com<br><br><div dir="ltr">So when CLIENTHOSTNAME is defined, it needs to get passed into $DAEMON (ie runclient.sh) with the "--hostname=" parameter, because that overrides $MACHINEDOTS, which is used in the PID filename.  If it cannot find the PID filename, it won't be able to get the PID and kill the process.<div>

<br></div><div>Yes, this looks like a bug.<br><div><br></div><div>I don't see how "restart" worked though.  Perhaps it looked like it restarted because it never stopped?</div><div><br></div><div>J</div><div>

<br></div></div></div><div class="ecxgmail_extra"><br><br><div class="ecxgmail_quote">On 25 September 2013 04:51, Bakkies Gatvol <span dir="ltr"><<a href="mailto:bakgat8@hotmail.com" target="_blank">bakgat8@hotmail.com</a>></span> wrote:<br>

<blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">


<div><div dir="ltr">I am documenting this for whomever else may need this. This file is from an rpm xymon-client-4.3.10-1 that I got off the net somewhere. I just figured out why the "stop" does not work.<br><br>

I set CLIENTHOSTNAME in here<br><br>=> more  /etc/default/xymon-client<br># Configure the Xymon client settings.<br><br># You MUST set the list of Xymon servers that this<br># client reports to.<br># It is good to use IP-adresses here instead of DNS <br>

# names - DNS might not work if there's a problem.<br>#<br># E.g. (a single Xymon server)<br>#   XYMONSERVERS="192.168.1.1" <br># or (multiple servers)<br>#   XYMONSERVERS="10.0.0.1 192.168.1.1" <br>

<br>XYMONSERVERS="10.65.1.66 10.65.20.151"<br><br># The defaults usually suffice for the rest of this file, <br># but you can tweak the hostname that the client reports <br># data with.<br><br># Thu Mar 21 15:30:16 EDT 2013<br>

CLIENTHOSTNAME="$(hostname | cut -f1 -d'.')"<br><br># Red Hat EL version 3 uses a different vmstat layout<br># than all other Linux versions. So for a client running this<br># particular OS, set CLIENTOS as below.<br>

# Do NOT set this on any other Red Hat version.<br># CLIENTOS="rhel3"<br><br><br>but the script does not pass that info on the stop - so the start worked fine, but the stop not. Even the restart worked. I fixed below <br>

<br>#<br># xymon-client    This shell script takes care of starting and stopping<br>#                 the Xymon client.<br>#<br># chkconfig: 2345 80 20<br># description: Xymon is a network monitoring tool that allows \<br>

# you to monitor hosts and services. This client reports local \<br># system statistics (cpu-, memory-, disk-utilisation etc) \<br># to the Xymon server.<br><br><br>PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin<br>

DAEMON=/usr/lib/xymon/client/runclient.sh<br>NAME=xymon-client<br>DESC=xymon-client<br><br>test -x $DAEMON || exit 0<br><br>CMD="$1"<br><br># Include xymon-client defaults if available<br>DMNOPTS=""<br>

if [ -f /etc/default/xymon-client ] ; then<br>        . /etc/default/xymon-client<br>else<br>        echo "Installation failure - missing /etc/default/xymon-client"<br>        exit 1<br>fi<br><br>if [ "$XYMONSERVERS" = "" ]; then<br>

        echo "Please configure XYMONSERVERS in /etc/default/xymon-client"<br>        exit 1<br>fi<br><br>set $XYMONSERVERS<br>if [ $# -eq 1 ]; then<br>        echo "XYMSRV=\"$XYMONSERVERS\"" >/var/run/xymonclient-runtime.cfg<br>

        echo "XYMSERVERS=\"\"" >>/var/run/xymonclient-runtime.cfg<br>else<br>        echo "XYMSRV=\"0.0.0.0\"" >/var/run/xymonclient-runtime.cfg<br>        echo "XYMSERVERS=\"$XYMONSERVERS\"" >>/var/run/xymonclient-runtime.cfg<br>

fi<br><br>if [ "$CLIENTHOSTNAME" != "" ]; then<br>        DMNOPTS="${DMNOPTS} --hostname=${CLIENTHOSTNAME}"<br>fi<br>if [ "$CLIENTOS" != "" ]; then<br>        DMNOPTS="${DMNOPTS} --os=${CLIENTOS}"<br>

fi<br><br>set -e<br><br>case "$CMD" in<br>  start)<br>        echo -n "Starting $DESC: "<br>        su -c "$DAEMON $DMNOPTS start" - xymon<br>        echo "$NAME."<br>        ;;<br>

  stop)<br> <font color="#2672EC">       echo -n "Stopping $DESC: "</font><font color="#2672EC"><br></font><font color="#2672EC">        su -c "$DAEMON stop" - xymon   ### is</font><font color="#2672EC"><br>

</font><b><font color="#2672EC">##        su -c "$DAEMON $DMNOPTS stop" - xymon   # ## should be this!!!</font></b><font color="#2672EC"><br></font><font color="#2672EC">        echo "$NAME."</font><br>

        ;;<br>  restart)<br>        echo -n "Restarting $DESC: "<br>        su -c "$DAEMON stop" - xymon<br>        su -c "$DAEMON $DMNOPTS start" - xymon<br>        echo "$NAME."<br>

        ;;<br>  *)<br>        N=/etc/init.d/$NAME<br>        # echo "Usage: $N {start|stop|restart}" >&2<br>        echo "Usage: $N {start|stop|restart}" >&2<br>        exit 1<br>        ;;<br>

esac<br><br>exit 0<br><br>                                        </div></div>
<br>_______________________________________________<br>
Xymon mailing list<br>
<a href="mailto:Xymon@xymon.com">Xymon@xymon.com</a><br>
<a href="http://lists.xymon.com/mailman/listinfo/xymon" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
<br></blockquote></div><br></div></div>                                       </div></body>
</html>