monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debian/ubuntu way to build ?


From: Clifford W. Hansen
Subject: Re: debian/ubuntu way to build ?
Date: Mon, 07 May 2007 07:12:41 +0200
User-agent: Thunderbird 2.0.0.0 (Windows/20070326)

Andrew,

The "debian way" is to build it like normal, and run monit with the -c option.

I have the following init script:
<script>
#!/bin/sh
# /etc/init.d/monit start and stop monit daemon monitor process.
# Fredrik Steen, address@hidden
:
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/monit
CONFIG="/etc/monit/monitrc"
DELAY="/etc/monit/monit_delay"
CHECK_INTERVALS=180
# We default to 180s (3min) check intervals
NAME=monit
DESC="daemon monitor"

set -e

# Check if DAEMON binary exist
test -f $DAEMON || exit 0

if [ -f "/etc/default/monit" ]; then
    . /etc/default/monit
fi

ARGS="-d $CHECK_INTERVALS -c $CONFIG -s /var/lib/monit/monit.state"

monit_not_configured () {
   echo -e "monit won't be started/stopped\n\tunless it it's configured"
   if [ "$1" != "stop" ]
       then
       echo -e "\tplease configure monit and then edit /etc/default/monit"
       echo -e "\tand set the \"startup\" variable to 1 in order to allow "
       echo -e "\tmonit to start"
   fi
   exit 0
}

monit_check_config () {
   # Check for emtpy config, probably default configfile.
   if [ "`grep -s -v \"^#\" $CONFIG`" = "" ]; then
       echo "empty config, please edit $CONFIG."
       exit 0
   fi
}

monit_check_perms () {
   # Check the permission on configfile.
   # The permission must not have more than -rwx------ (0700) permissions.
# Skip checking, fix perms instead.
   /bin/chmod go-rwx $CONFIG

}

monit_delayed_monitoring () {
   if [ -x $DELAY ]; then
     $DELAY &
   elif [ -f $DELAY ]; then
     echo
echo "[WARNING] A delayed start file exists ($DELAY) but it is not executable."
   fi
}

monit_check_syntax () {
 $DAEMON -t;
#  if [ $? ] ; then
#      echo "syntax good"
#  else
#      echo "syntax bad"
#  fi
}


monit_checks () {
   # Check if startup variable is set to 1, if not we exit.
   if [ "$startup" != "1" ]; then
       monit_not_configured $1
   fi
   # Check for emtpy configfile
   monit_check_config
   # Check permissions of configfile
   monit_check_perms
}

case "$1" in
 start)
   echo -n "Starting $DESC: "
   monit_checks $1
   echo -n "$NAME"
   start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
       --exec $DAEMON > /dev/null 2>&1 -- $ARGS
  monit_delayed_monitoring
   echo "."
   ;;
 stop)
   echo -n "Stopping $DESC: "
   #monit_checks $1
   echo -n "$NAME"
   start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/$NAME.pid \
       --exec $DAEMON  > /dev/null 2>&1
   echo "."
   ;;
 restart|force-reload)
   $0 stop
   sleep 1
   $0 start
   ;;
 syntax)
  monit_check_syntax
  ;;
 *)
   N=/etc/init.d/$NAME
   echo "Usage: $N {start|stop|restart|force-reload|syntax}" >&2
   exit 1
   ;;
esac

exit 0
</script>

This is in "/etc/init.d/monit" and then you can use the normal "deamon" setup for monit. "/etc/init.d/monit start"

Hope this helps and makes sence...

Clifford

andrew.taylor wrote:
on ubuntu, I did apt-get install -y monit, and I get monit 4.8.1
one place it looks for monitrc is /etc/monit/monitrc

I wanted monit 4.9, so I download, tar -zxvf, ./configure, make, sudo make install
it looks for monitrc in /etc/monitrc

Is there something special to get it build the "debian way" ?

-- Thanks, Andrew


--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

[Prev in Thread] Current Thread [Next in Thread]