#1  
Old 21st May 2012, 22:47
Andreas0815 Andreas0815 is offline
Junior Member
 
Join Date: Jun 2010
Posts: 27
Thanks: 0
Thanked 2 Times in 2 Posts
Default Monit start failed

Hi!

Today I installied Monit following this tutorial but monit won#t start:
Code:
# /etc/init.d/monit start
/etc/init.d/monit: 39: [: start: unexpected operator
        Please, use MONIT_OPTS variable in /etc/default/monit
        to specify command line options for monit.
 * Starting daemon monitor monit                                         [ OK ]
The Tutorial is from 2006 and for Debian, so I'm sure something changed for Ubuntu 12.04 But what?

Can you help me?

Thanks a lot!
Andreas
Reply With Quote
Sponsored Links
  #2  
Old 21st May 2012, 23:42
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,158
Thanks: 4
Thanked 58 Times in 54 Posts
Default

what's line 39?
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
  #3  
Old 22nd May 2012, 16:19
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,752 Times in 2,582 Posts
Default

Quote:
Originally Posted by Andreas0815 View Post
The Tutorial is from 2006 and for Debian, so I'm sure something changed for Ubuntu 12.04 But what?
You should use this guide instead: http://www.howtoforge.com/server-mon...ian-squeeze-p2
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #4  
Old 22nd May 2012, 20:05
Andreas0815 Andreas0815 is offline
Junior Member
 
Join Date: Jun 2010
Posts: 27
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Thank you Falko, I will try this and let you know if it worked
Reply With Quote
  #5  
Old 22nd May 2012, 20:50
Andreas0815 Andreas0815 is offline
Junior Member
 
Join Date: Jun 2010
Posts: 27
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Well, I followed the tutorial you linked, but...:
Code:
# /etc/init.d/monit start
/etc/init.d/monit: 39: [: start: unexpected operator
 * Starting daemon monitor monit                                         [ OK ]
Code:
#!/bin/sh

### BEGIN INIT INFO
# Provides:          monit
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Should-Start:      $all
# Should-Stop:       $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: service and resource monitoring daemon
# Description:       monit is a utility for managing and monitoring
#                    processes, programs, files, directories and filesystems
#                    on a Unix system. Monit conducts automatic maintenance
#                    and repair and can execute meaningful causal actions
#                    in error situations.
### END INIT INFO

set -e

. /lib/lsb/init-functions

DAEMON=/usr/bin/monit
CONFIG="/etc/monit/monitrc"
DELAY="/etc/monit/monit_delay"
NAME=monit
DESC="daemon monitor"
MONIT_OPTS=
PID="/var/run/$NAME.pid"

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

[ -f "/etc/default/$NAME" ] && . /etc/default/$NAME

# For backward compatibility, handle startup variable:
if [ -n "$startup" ]
then
  if [ "$1" == "start" ]
  then
    printf "\tPlease, use START variable in /etc/default/monit\n"
    printf "\tto enable/disable $NAME startup.\n"
  fi

  if [ -z "$START" ] && [ "$startup" -eq 1 ]
  then
    START="yes"
  fi
fi

# For backward compatibility, handle CHECK_INTERVALS variable:
if [ -n "$CHECK_INTERVALS" ]
then
  if [ "$1" = "start" ]
  then
    printf "\tPlease, use MONIT_OPTS variable in /etc/default/monit\n"
    printf "\tto specify command line options for $NAME.\n"
  fi

  MONIT_OPTS="$MONIT_OPTS -d $CHECK_INTERVALS"
fi

MONIT_OPTS="-c $CONFIG $MONIT_OPTS"

monit_not_configured () {
  if [ "$1" != "stop" ]
  then
    printf "\tplease configure $NAME and then edit /etc/default/$NAME\n"
    printf "\tand set the \"START\" variable to \"yes\" in order to allow\n"
    printf "\t$NAME to start\n"
  fi
  exit 0
}

monit_check_config () {
  # Check for emtpy config.
  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 [ -f $DELAY ]
  then
    printf "Warning: Please, set start delay for $NAME in config file\n"
    printf "         and delete $DELAY file.\n"

    if [ ! -x $DELAY ]
    then
      printf "Warning: A delayed start file exists ($DELAY)\n"
      printf "         but it is not executable.\n"
    else
      $DELAY &
    fi
  fi
}

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

case "$1" in
  start)
    log_daemon_msg "Starting $DESC" "$NAME"
    monit_checks $1
    if start-stop-daemon --start --quiet --oknodo \
                         --pidfile $PID --exec $DAEMON \
                         -- $MONIT_OPTS
    then
      log_end_msg 0
    else
      log_end_msg 1
    fi
    monit_delayed_monitoring
    ;;
  stop)
    log_daemon_msg "Stopping $DESC" "$NAME"
    if start-stop-daemon --retry TERM/5/KILL/5 --oknodo --stop --quiet \
                         --pidfile $PID --exec $DAEMON
    then
      log_end_msg 0
    else
      log_end_msg 1
    fi
    ;;
  reload)
    log_daemon_msg "Reloading $DESC configuration" "$NAME"
    if start-stop-daemon --stop --signal HUP --quiet \
                                --oknodo --pidfile $PID \
                                --exec $DAEMON -- $MONIT_OPTS
    then
      log_end_msg 0
    else
      log_end_msg 1
        fi
    ;;
  restart|force-reload)
    $0 stop
    $0 start
    ;;
  syntax)
    $DAEMON $MONIT_OPTS -t
    ;;
  status)
    status_of_proc -p $PID $DAEMON $NAME
    ;;
  *)
    log_action_msg "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|syntax|status}"
    ;;
esac

exit 0
(Line 39 is marked red)
Reply With Quote
  #6  
Old 22nd May 2012, 21:05
Andreas0815 Andreas0815 is offline
Junior Member
 
Join Date: Jun 2010
Posts: 27
Thanks: 0
Thanked 2 Times in 2 Posts
 
Default

Hooray, it works!

There is a bug in the init-Script: https://bugs.launchpad.net/ubuntu/+s...it/+bug/993381
Now it works fine
Reply With Quote
The Following User Says Thank You to Andreas0815 For This Useful Post:
falko (23rd May 2012)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Monit & Munin SamTzu HOWTO-Related Questions 2 23rd September 2014 23:20
Need help with ISPConfig Mail and Squirrelmail m.xander Installation/Configuration 109 3rd February 2012 01:15
monitrc configuration for Debian ISPConfig 3 server Hans Tips/Tricks/Mods 2 28th March 2011 00:22
Systemimager (rsync) doesn't copy all comedit HOWTO-Related Questions 11 19th January 2007 18:17
How to install BFD (Brute Force Detection) domino Tips/Tricks/Mods 9 31st March 2006 23:40


All times are GMT +2. The time now is 02:33.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.