[Slackbuilds-users] Fwd: monit change request

Bryan Harris bryanlharris at gmail.com
Fri Aug 5 18:17:31 UTC 2016


Hi all,

Would it be alright for me to take over maintaining the monit package?
 I emailed the author (forwarded below) who says he is not the
maintainer anymore.

I would like to "upstreamify" the package (if you take the meaning).
What I want to do is make it behave "out of the box" like the monit
author (and me) would like to use it normally.  The main thing being
to make the "monit <command>" commands work by way of renaming the
config back to the the default name hard-coded into monit.  The
default name is monitrc as opposed to monit.conf (Red Hat uses that
name but they patched the source code to make it work right).

E.g. monit summary, monit status, monit start <service>, monit stop
<service>, etc.  Those commands work with the config named monitrc,
but not if the config named monit.conf.

Funny thing is I emailed Willy a while back to change it to monit.conf
based on the rc.monit saying monit.conf.  Only now I realize I was
pushing the wrong direction.  I should have gone the other way.

My changes are below.  Or is there a better way to submit the changes?

V/r,
Bryan

diff --git a/system/monit/doinst.sh b/system/monit/doinst.sh
index 293507c..3cac70a 100644
--- a/system/monit/doinst.sh
+++ b/system/monit/doinst.sh
@@ -23,5 +23,5 @@ preserve_perms() {
 }

 preserve_perms etc/rc.d/rc.monit.new
-config etc/monit.conf.new
+config etc/monitrc.new

diff --git a/system/monit/monit.SlackBuild b/system/monit/monit.SlackBuild
index 8cabf18..5b6eaf3 100644
--- a/system/monit/monit.SlackBuild
+++ b/system/monit/monit.SlackBuild
@@ -92,7 +92,7 @@ find $PKG -print0 | xargs -0 file | grep -e
"executable" -e "shared object" | gr
 find $PKG/usr/man -type f -exec gzip -9 {} \;
 for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i
).gz $i.gz ; rm $i ; done

-cp monitrc $PKG/etc/monit.conf.new
+cp monitrc $PKG/etc/monitrc.new

 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
 cp -a COPYING CONTRIBUTORS README $PKG/usr/doc/$PRGNAM-$VERSION
diff --git a/system/monit/monit.info b/system/monit/monit.info
index e3c8549..9882485 100644
--- a/system/monit/monit.info
+++ b/system/monit/monit.info
@@ -6,5 +6,5 @@ MD5SUM="a1bfac0fbb83439435f8616200d2364d"
 DOWNLOAD_x86_64=""
 MD5SUM_x86_64=""
 REQUIRES=""
-MAINTAINER="Ricardson Williams"
-EMAIL="ricardsonwilliams at yahoo.com.br"
+MAINTAINER="Bryan Harris"
+EMAIL="bryanlharris at gmail.com"
diff --git a/system/monit/rc.monit b/system/monit/rc.monit
index f1bd510..b68e373 100644
--- a/system/monit/rc.monit
+++ b/system/monit/rc.monit
@@ -7,8 +7,7 @@
 #

 ### Default variables
-CONFIG="/etc/monit.conf"
-PIDFILE="/var/run/monit.pid"
+CONFIG="/etc/monitrc"

 [ -x /usr/bin/monit ] || exit 1
 [ -r "$CONFIG" ] || exit 1
@@ -19,17 +18,13 @@ desc="Process Monitor"

 start() {
   echo "Starting $desc ($prog):  /etc/rc.d/rc.$prog start"
-  $prog -c $CONFIG -p $PIDFILE
+  $prog -c $CONFIG
   return $?
 }

 stop() {
   echo "Shutting down $desc ($prog)..."
-  if [ -f $PIDFILE ]; then
-    kill -TERM $(cat $PIDFILE)
-  else
-    killall -TERM $prog
-  fi
+  monit quit
   return $?
 }

@@ -45,12 +40,7 @@ reload() {
 }

 status() {
-  PIDS=$(pidof $prog)
-  if [ "$PIDS" == "" ]; then
-    echo "$prog is not running!"
-  else
-    echo "$prog is running at pid(s) ${PIDS}."
-  fi
+  monit status
   return $?
 }



---------- Forwarded message ----------
From: Ricardson <ricardsonwilliams at gmail.com>
Date: Fri, Aug 5, 2016 at 1:47 PM
Subject: Re: monit change request
To: Bryan Harris <bryanlharris at gmail.com>, ricardsonwilliams at yahoo.com.br


Hi! Bryan,

   You can make the changes because I'm not maintain this package
anymore, I think it's possible to change th maintainer in SBO.


Cheers,
Obrigado,
Ricardson‎


Sent from my BlackBerry 10 smartphone.
From: Bryan Harris
Sent: Friday, August 5, 2016 14:43
To: ricardsonwilliams at yahoo.com.br
Subject: monit change request

Hi Richardson,

Would it be possible to make the following changes to the monit
package on SBo?  I think it would put it more inline with (A) deliver
the software like the author has it and (B) it would allow commands
like "monit status" to work without any additional configuration.

As it currently is, if I install the package and run the monit daemon
with the rc.monit script it works fine; but further monit commands
don't work (monit status, monit summary, monit quit, etc.) because
both the configuration file and PID file have been moved to different
names than monit expects by default.  As a monit user, I use those
commands all the time, so I think it would be nice if those commands
worked without additional configuration.

Here are all the changes (below).  In summary: I replaced all the PID
logic in the rc.monit script with monit commands (because that same
logic is built into monit) and then I renamed monit.conf to monitrc in
relevant places.  I also gave a monit style status for the rc.monit
status option.

V/r,
Bryan

diff --git a/system/monit/doinst.sh b/system/monit/doinst.sh
index 293507c..3cac70a 100644
--- a/system/monit/doinst.sh
+++ b/system/monit/doinst.sh
@@ -23,5 +23,5 @@ preserve_perms() {
 }

 preserve_perms etc/rc.d/rc.monit.new
-config etc/monit.conf.new
+config etc/monitrc.new

diff --git a/system/monit/monit.SlackBuild b/system/monit/monit.SlackBuild
index 8cabf18..5b6eaf3 100644
--- a/system/monit/monit.SlackBuild
+++ b/system/monit/monit.SlackBuild
@@ -92,7 +92,7 @@ find $PKG -print0 | xargs -0 file | grep -e
"executable" -e "shared object" | gr
 find $PKG/usr/man -type f -exec gzip -9 {} \;
 for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i
).gz $i.gz ; rm $i ; done

-cp monitrc $PKG/etc/monit.conf.new
+cp monitrc $PKG/etc/monitrc.new

 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
 cp -a COPYING CONTRIBUTORS README $PKG/usr/doc/$PRGNAM-$VERSION
diff --git a/system/monit/rc.monit b/system/monit/rc.monit
index f1bd510..b68e373 100644
--- a/system/monit/rc.monit
+++ b/system/monit/rc.monit
@@ -7,8 +7,7 @@
 #

 ### Default variables
-CONFIG="/etc/monit.conf"
-PIDFILE="/var/run/monit.pid"
+CONFIG="/etc/monitrc"

 [ -x /usr/bin/monit ] || exit 1
 [ -r "$CONFIG" ] || exit 1
@@ -19,17 +18,13 @@ desc="Process Monitor"

 start() {
   echo "Starting $desc ($prog):  /etc/rc.d/rc.$prog start"
-  $prog -c $CONFIG -p $PIDFILE
+  $prog -c $CONFIG
   return $?
 }

 stop() {
   echo "Shutting down $desc ($prog)..."
-  if [ -f $PIDFILE ]; then
-    kill -TERM $(cat $PIDFILE)
-  else
-    killall -TERM $prog
-  fi
+  monit quit
   return $?
 }

@@ -45,12 +40,7 @@ reload() {
 }

 status() {
-  PIDS=$(pidof $prog)
-  if [ "$PIDS" == "" ]; then
-    echo "$prog is not running!"
-  else
-    echo "$prog is running at pid(s) ${PIDS}."
-  fi
+  monit status
   return $?
 }


More information about the SlackBuilds-users mailing list