Running init.d script produces “start-stop-daemon: not found”start-stop-daemon won't start my Python...

Declaring a visitor to the UK as my "girlfriend" - effect on getting a Visitor visa?

How does Rust's 128-bit integer `i128` work on a 64-bit system?

A conjectural trigonometric identity

δόλος = deceit in John 1:47

Heinlein story regarding suspended animation and reading newspapers?

Protect a 6 inch air hose from physical damage

Map vs. Table for index-specific operations on 2D arrays

Why is “deal 6 damage” a legit phrase?

Who's behind community AMIs on Amazon EC2?

Pre-Greek θάλασσα "thalassa" and Turkish talaz

What's the proper way of indicating that a car has reached its destination during a dialogue?

Feedback diagram

Define tcolorbox in math mode

Overprovisioning SSD on ubuntu. How? Ubuntu 19.04 Samsung SSD 860

What is the most 'environmentally friendly' way to learn to fly?

What do the screens say after you are set free?

How do I respond appropriately to an overseas company that obtained a visa for me without hiring me?

Move label of an angle in Tikz

Word to describe someone doing something even though told not to

How do I safety check that there is no light in Darkroom / Darkbag?

Why did the United States not resort to nuclear weapons in Vietnam?

Adding a (stair/baby) gate without facing walls

How to structure presentation to avoid getting questions that will be answered later in the presentation?

Skipping same old introductions



Running init.d script produces “start-stop-daemon: not found”


start-stop-daemon won't start my Python script as servicestart-stop-daemon, services, environment variables, and ansibleHow to delay a service startup on boot in Debian?init.d script : how to stop all process tree with start-stop-daemonstart-stop-daemon blocks for process with infinite loopWhy “start-stop-daemon” spawns two processes?Configuring Debian's opendkim package's init script parameters with both init.d and systemctl scripts being presentstart-stop-daemon Python script as service using SSLno process in pidfile; found running, none killedpidofproc or pidof working from init.d but not from /usr/sbin






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







5















I try to start monit using:



/etc/init.d/monit start


I then get the error:



[....] Starting daemon monitor: monit/etc/init.d/monit: 124: /etc/init.d/monit: start-stop-daemon: not found
failed!


Typing



which start-stop-daemon


shows



/sbin/start-stop-daemon


ls -al in /sbin shows



-rwxr-xr-x   1 root root     26740 Jan 21 12:18 start-stop-daemon


edit: adding script



#!/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/monitn"
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/monitn"
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/$NAMEn"
printf "tand set the "START" variable to "yes" in order to allown"
printf "t$NAME to startn"
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 filen"
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









share|improve this question



























  • Perhaps they should specify the full path in the init script.

    – muru
    Jan 21 '15 at 20:30











  • I faced a similar problem with the Live version of Squeeze before. Is this Debian Live by any chance?

    – Joseph R.
    Jan 21 '15 at 22:02






  • 1





    Are you trying to run /etc/init.d/monit start as root?

    – Teresa e Junior
    Jan 21 '15 at 22:19






  • 1





    The fact that echo $PATH; exit gave you a strange error means some serious problem with your script. No problems with unprintable characters? Are the end-of-lines correct?

    – vinc17
    Jan 22 '15 at 0:31






  • 1





    @TeresaeJunior The missing newline is normal: start-stop-daemon waits for the command to terminate, then it should write OK or FAIL in [....]. Since this must be done on the same line, a newline is not output before that.

    – vinc17
    Jan 22 '15 at 1:35


















5















I try to start monit using:



/etc/init.d/monit start


I then get the error:



[....] Starting daemon monitor: monit/etc/init.d/monit: 124: /etc/init.d/monit: start-stop-daemon: not found
failed!


Typing



which start-stop-daemon


shows



/sbin/start-stop-daemon


ls -al in /sbin shows



-rwxr-xr-x   1 root root     26740 Jan 21 12:18 start-stop-daemon


edit: adding script



#!/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/monitn"
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/monitn"
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/$NAMEn"
printf "tand set the "START" variable to "yes" in order to allown"
printf "t$NAME to startn"
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 filen"
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









share|improve this question



























  • Perhaps they should specify the full path in the init script.

    – muru
    Jan 21 '15 at 20:30











  • I faced a similar problem with the Live version of Squeeze before. Is this Debian Live by any chance?

    – Joseph R.
    Jan 21 '15 at 22:02






  • 1





    Are you trying to run /etc/init.d/monit start as root?

    – Teresa e Junior
    Jan 21 '15 at 22:19






  • 1





    The fact that echo $PATH; exit gave you a strange error means some serious problem with your script. No problems with unprintable characters? Are the end-of-lines correct?

    – vinc17
    Jan 22 '15 at 0:31






  • 1





    @TeresaeJunior The missing newline is normal: start-stop-daemon waits for the command to terminate, then it should write OK or FAIL in [....]. Since this must be done on the same line, a newline is not output before that.

    – vinc17
    Jan 22 '15 at 1:35














5












5








5








I try to start monit using:



/etc/init.d/monit start


I then get the error:



[....] Starting daemon monitor: monit/etc/init.d/monit: 124: /etc/init.d/monit: start-stop-daemon: not found
failed!


Typing



which start-stop-daemon


shows



/sbin/start-stop-daemon


ls -al in /sbin shows



-rwxr-xr-x   1 root root     26740 Jan 21 12:18 start-stop-daemon


edit: adding script



#!/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/monitn"
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/monitn"
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/$NAMEn"
printf "tand set the "START" variable to "yes" in order to allown"
printf "t$NAME to startn"
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 filen"
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









share|improve this question
















I try to start monit using:



/etc/init.d/monit start


I then get the error:



[....] Starting daemon monitor: monit/etc/init.d/monit: 124: /etc/init.d/monit: start-stop-daemon: not found
failed!


Typing



which start-stop-daemon


shows



/sbin/start-stop-daemon


ls -al in /sbin shows



-rwxr-xr-x   1 root root     26740 Jan 21 12:18 start-stop-daemon


edit: adding script



#!/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/monitn"
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/monitn"
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/$NAMEn"
printf "tand set the "START" variable to "yes" in order to allown"
printf "t$NAME to startn"
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 filen"
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






debian sysvinit start-stop-daemon






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 12:08









Rui F Ribeiro

41.1k16 gold badges92 silver badges153 bronze badges




41.1k16 gold badges92 silver badges153 bronze badges










asked Jan 21 '15 at 20:11









JonSJonS

261 gold badge1 silver badge4 bronze badges




261 gold badge1 silver badge4 bronze badges
















  • Perhaps they should specify the full path in the init script.

    – muru
    Jan 21 '15 at 20:30











  • I faced a similar problem with the Live version of Squeeze before. Is this Debian Live by any chance?

    – Joseph R.
    Jan 21 '15 at 22:02






  • 1





    Are you trying to run /etc/init.d/monit start as root?

    – Teresa e Junior
    Jan 21 '15 at 22:19






  • 1





    The fact that echo $PATH; exit gave you a strange error means some serious problem with your script. No problems with unprintable characters? Are the end-of-lines correct?

    – vinc17
    Jan 22 '15 at 0:31






  • 1





    @TeresaeJunior The missing newline is normal: start-stop-daemon waits for the command to terminate, then it should write OK or FAIL in [....]. Since this must be done on the same line, a newline is not output before that.

    – vinc17
    Jan 22 '15 at 1:35



















  • Perhaps they should specify the full path in the init script.

    – muru
    Jan 21 '15 at 20:30











  • I faced a similar problem with the Live version of Squeeze before. Is this Debian Live by any chance?

    – Joseph R.
    Jan 21 '15 at 22:02






  • 1





    Are you trying to run /etc/init.d/monit start as root?

    – Teresa e Junior
    Jan 21 '15 at 22:19






  • 1





    The fact that echo $PATH; exit gave you a strange error means some serious problem with your script. No problems with unprintable characters? Are the end-of-lines correct?

    – vinc17
    Jan 22 '15 at 0:31






  • 1





    @TeresaeJunior The missing newline is normal: start-stop-daemon waits for the command to terminate, then it should write OK or FAIL in [....]. Since this must be done on the same line, a newline is not output before that.

    – vinc17
    Jan 22 '15 at 1:35

















Perhaps they should specify the full path in the init script.

– muru
Jan 21 '15 at 20:30





Perhaps they should specify the full path in the init script.

– muru
Jan 21 '15 at 20:30













I faced a similar problem with the Live version of Squeeze before. Is this Debian Live by any chance?

– Joseph R.
Jan 21 '15 at 22:02





I faced a similar problem with the Live version of Squeeze before. Is this Debian Live by any chance?

– Joseph R.
Jan 21 '15 at 22:02




1




1





Are you trying to run /etc/init.d/monit start as root?

– Teresa e Junior
Jan 21 '15 at 22:19





Are you trying to run /etc/init.d/monit start as root?

– Teresa e Junior
Jan 21 '15 at 22:19




1




1





The fact that echo $PATH; exit gave you a strange error means some serious problem with your script. No problems with unprintable characters? Are the end-of-lines correct?

– vinc17
Jan 22 '15 at 0:31





The fact that echo $PATH; exit gave you a strange error means some serious problem with your script. No problems with unprintable characters? Are the end-of-lines correct?

– vinc17
Jan 22 '15 at 0:31




1




1





@TeresaeJunior The missing newline is normal: start-stop-daemon waits for the command to terminate, then it should write OK or FAIL in [....]. Since this must be done on the same line, a newline is not output before that.

– vinc17
Jan 22 '15 at 1:35





@TeresaeJunior The missing newline is normal: start-stop-daemon waits for the command to terminate, then it should write OK or FAIL in [....]. Since this must be done on the same line, a newline is not output before that.

– vinc17
Jan 22 '15 at 1:35










3 Answers
3






active

oldest

votes


















5














On Debian 7 I had a similar error: daemon: not found



And I was able to fix it with:



apt-get install daemon





share|improve this answer




























  • I also tried on Debian 8 (Jessie) and it worked as a charm!

    – Ali Yousefi Sabzevar
    Aug 27 '16 at 4:27



















3
















  1. Make sure to add PATH to your script and that it includes /sbin. Since the init script won't share the PATH environment variable with the rest of the system you need to set it directly on your script and make sure /sbin is in there, for example, add:



     PATH=/sbin:/bin:/usr/sbin:/usr/bin


    At the beginning of your script.




  2. Debug your script to make sure start-stop-daemon is reading the path of monit correctly from the DAEMON variable. In order to do that add the following line at the beginning of your script:



    set -x #echo on


    The whole thing would look like



    #!/bin/sh
    set -x #echo on
    ### 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

    PATH=/sbin:/rest of your path here.


    Your script.



    If DAEMON is corrupted somehow try surrounding it with parenthesis:



    if start-stop-daemon --start --quiet --oknodo 
    --pidfile $PID --exec $($DAEMON)
    -- $MONIT_OPTS


    Or simply add the path to the binary directly.



        if start-stop-daemon --start --quiet --oknodo 
    --pidfile $PID --exec /usr/bin/monit
    -- $MONIT_OPTS


  3. If the last option doesn't work then make sure the binary is actually there. If it is then you will have to check if start-stop-daemon is actually permitted to access it. Look into chrooting.







share|improve this answer



































    0














    glad, you could fix it with apt-get install deamon



    in my case it was a missing link from: /bin/busybox to /sbin/start-stop-daemon



    cd /sbin
    ln -s ../bin/busybox start-stop-daemon


    that fixed it.






    share|improve this answer






























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f180342%2frunning-init-d-script-produces-start-stop-daemon-not-found%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      5














      On Debian 7 I had a similar error: daemon: not found



      And I was able to fix it with:



      apt-get install daemon





      share|improve this answer




























      • I also tried on Debian 8 (Jessie) and it worked as a charm!

        – Ali Yousefi Sabzevar
        Aug 27 '16 at 4:27
















      5














      On Debian 7 I had a similar error: daemon: not found



      And I was able to fix it with:



      apt-get install daemon





      share|improve this answer




























      • I also tried on Debian 8 (Jessie) and it worked as a charm!

        – Ali Yousefi Sabzevar
        Aug 27 '16 at 4:27














      5












      5








      5







      On Debian 7 I had a similar error: daemon: not found



      And I was able to fix it with:



      apt-get install daemon





      share|improve this answer















      On Debian 7 I had a similar error: daemon: not found



      And I was able to fix it with:



      apt-get install daemon






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited 45 mins ago









      hobs

      1275 bronze badges




      1275 bronze badges










      answered Sep 30 '15 at 14:04









      guakaguaka

      3712 gold badges5 silver badges16 bronze badges




      3712 gold badges5 silver badges16 bronze badges
















      • I also tried on Debian 8 (Jessie) and it worked as a charm!

        – Ali Yousefi Sabzevar
        Aug 27 '16 at 4:27



















      • I also tried on Debian 8 (Jessie) and it worked as a charm!

        – Ali Yousefi Sabzevar
        Aug 27 '16 at 4:27

















      I also tried on Debian 8 (Jessie) and it worked as a charm!

      – Ali Yousefi Sabzevar
      Aug 27 '16 at 4:27





      I also tried on Debian 8 (Jessie) and it worked as a charm!

      – Ali Yousefi Sabzevar
      Aug 27 '16 at 4:27













      3
















      1. Make sure to add PATH to your script and that it includes /sbin. Since the init script won't share the PATH environment variable with the rest of the system you need to set it directly on your script and make sure /sbin is in there, for example, add:



         PATH=/sbin:/bin:/usr/sbin:/usr/bin


        At the beginning of your script.




      2. Debug your script to make sure start-stop-daemon is reading the path of monit correctly from the DAEMON variable. In order to do that add the following line at the beginning of your script:



        set -x #echo on


        The whole thing would look like



        #!/bin/sh
        set -x #echo on
        ### 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

        PATH=/sbin:/rest of your path here.


        Your script.



        If DAEMON is corrupted somehow try surrounding it with parenthesis:



        if start-stop-daemon --start --quiet --oknodo 
        --pidfile $PID --exec $($DAEMON)
        -- $MONIT_OPTS


        Or simply add the path to the binary directly.



            if start-stop-daemon --start --quiet --oknodo 
        --pidfile $PID --exec /usr/bin/monit
        -- $MONIT_OPTS


      3. If the last option doesn't work then make sure the binary is actually there. If it is then you will have to check if start-stop-daemon is actually permitted to access it. Look into chrooting.







      share|improve this answer
































        3
















        1. Make sure to add PATH to your script and that it includes /sbin. Since the init script won't share the PATH environment variable with the rest of the system you need to set it directly on your script and make sure /sbin is in there, for example, add:



           PATH=/sbin:/bin:/usr/sbin:/usr/bin


          At the beginning of your script.




        2. Debug your script to make sure start-stop-daemon is reading the path of monit correctly from the DAEMON variable. In order to do that add the following line at the beginning of your script:



          set -x #echo on


          The whole thing would look like



          #!/bin/sh
          set -x #echo on
          ### 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

          PATH=/sbin:/rest of your path here.


          Your script.



          If DAEMON is corrupted somehow try surrounding it with parenthesis:



          if start-stop-daemon --start --quiet --oknodo 
          --pidfile $PID --exec $($DAEMON)
          -- $MONIT_OPTS


          Or simply add the path to the binary directly.



              if start-stop-daemon --start --quiet --oknodo 
          --pidfile $PID --exec /usr/bin/monit
          -- $MONIT_OPTS


        3. If the last option doesn't work then make sure the binary is actually there. If it is then you will have to check if start-stop-daemon is actually permitted to access it. Look into chrooting.







        share|improve this answer






























          3












          3








          3









          1. Make sure to add PATH to your script and that it includes /sbin. Since the init script won't share the PATH environment variable with the rest of the system you need to set it directly on your script and make sure /sbin is in there, for example, add:



             PATH=/sbin:/bin:/usr/sbin:/usr/bin


            At the beginning of your script.




          2. Debug your script to make sure start-stop-daemon is reading the path of monit correctly from the DAEMON variable. In order to do that add the following line at the beginning of your script:



            set -x #echo on


            The whole thing would look like



            #!/bin/sh
            set -x #echo on
            ### 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

            PATH=/sbin:/rest of your path here.


            Your script.



            If DAEMON is corrupted somehow try surrounding it with parenthesis:



            if start-stop-daemon --start --quiet --oknodo 
            --pidfile $PID --exec $($DAEMON)
            -- $MONIT_OPTS


            Or simply add the path to the binary directly.



                if start-stop-daemon --start --quiet --oknodo 
            --pidfile $PID --exec /usr/bin/monit
            -- $MONIT_OPTS


          3. If the last option doesn't work then make sure the binary is actually there. If it is then you will have to check if start-stop-daemon is actually permitted to access it. Look into chrooting.







          share|improve this answer

















          1. Make sure to add PATH to your script and that it includes /sbin. Since the init script won't share the PATH environment variable with the rest of the system you need to set it directly on your script and make sure /sbin is in there, for example, add:



             PATH=/sbin:/bin:/usr/sbin:/usr/bin


            At the beginning of your script.




          2. Debug your script to make sure start-stop-daemon is reading the path of monit correctly from the DAEMON variable. In order to do that add the following line at the beginning of your script:



            set -x #echo on


            The whole thing would look like



            #!/bin/sh
            set -x #echo on
            ### 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

            PATH=/sbin:/rest of your path here.


            Your script.



            If DAEMON is corrupted somehow try surrounding it with parenthesis:



            if start-stop-daemon --start --quiet --oknodo 
            --pidfile $PID --exec $($DAEMON)
            -- $MONIT_OPTS


            Or simply add the path to the binary directly.



                if start-stop-daemon --start --quiet --oknodo 
            --pidfile $PID --exec /usr/bin/monit
            -- $MONIT_OPTS


          3. If the last option doesn't work then make sure the binary is actually there. If it is then you will have to check if start-stop-daemon is actually permitted to access it. Look into chrooting.








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 2 '15 at 21:07









          perror

          2,0005 gold badges21 silver badges39 bronze badges




          2,0005 gold badges21 silver badges39 bronze badges










          answered Sep 2 '15 at 20:12









          einarceinarc

          1334 bronze badges




          1334 bronze badges


























              0














              glad, you could fix it with apt-get install deamon



              in my case it was a missing link from: /bin/busybox to /sbin/start-stop-daemon



              cd /sbin
              ln -s ../bin/busybox start-stop-daemon


              that fixed it.






              share|improve this answer
































                0














                glad, you could fix it with apt-get install deamon



                in my case it was a missing link from: /bin/busybox to /sbin/start-stop-daemon



                cd /sbin
                ln -s ../bin/busybox start-stop-daemon


                that fixed it.






                share|improve this answer






























                  0












                  0








                  0







                  glad, you could fix it with apt-get install deamon



                  in my case it was a missing link from: /bin/busybox to /sbin/start-stop-daemon



                  cd /sbin
                  ln -s ../bin/busybox start-stop-daemon


                  that fixed it.






                  share|improve this answer















                  glad, you could fix it with apt-get install deamon



                  in my case it was a missing link from: /bin/busybox to /sbin/start-stop-daemon



                  cd /sbin
                  ln -s ../bin/busybox start-stop-daemon


                  that fixed it.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Sep 3 '16 at 6:54









                  techraf

                  4,36310 gold badges23 silver badges43 bronze badges




                  4,36310 gold badges23 silver badges43 bronze badges










                  answered Sep 3 '16 at 6:31









                  dese.co.ukdese.co.uk

                  1




                  1

































                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f180342%2frunning-init-d-script-produces-start-stop-daemon-not-found%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                      Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                      Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...