From: Hendrik F. <hen...@we...> - 2011-07-28 15:48:17
|
Hello Again, see the start of the script: PATH_BIN=/bin:/usr/bin:/sbin:/usr/sbin DAEMON=/usr/bin/motion and later: start-stop-daemon --start --oknodo --exec $DAEMON -b --chuid motion It should find motion... On the other hand: The error was, that start-stop-daemon was not found. This is in /sbin/. So it migth in fact be a PATH Problem. Greetings, Hendrik Am 28.07.2011 16:03, schrieb Artur Pinheiro: > Hi, > > do the script work if invoked manually? > > I think your problem is then PATH environment variable not initialised > correctly. > > Em 27-07-2011 22:46, Andrew Burgess escreveu: >> On 07/27/2011 09:56:42 AM, Hendrik Friedel wrote: >> >>> that gives me: >>> Starting motion detection daemon: motion/etc/init.d/motion: 103: >>> start-stop-daemon: not found >>> failed! >>> Stopping motion detection daemon: motion/etc/init.d/motion: 103: >>> start-stop-daemon: not found >>> failed! >> i dont use debian so grain of salt. >> >> where is the motion executable? does the PATH_BIN= statement catch it? >> >> other debug suggestions: >> >> is start-stop-daemon defined in /lib/lsb/init-functions? >> look at it and try to see whats going on. >> >> add a set -x to the script or start it with sh -x ... >> might tell you something >> >> >> >>> That's odd, isn't it? >>> >>> I've attached the script. >>> >>> Greetings, >>> Hendrik >>> >>> >>> #!/bin/sh -e >>> # >>> # /etc/init.d/motion: Start the motion detection >>> # >>> ### BEGIN INIT INFO >>> # Provides: motion >>> # Required-Start: $local_fs $syslog $remote_fs >>> # Required-Stop: $remote_fs >>> # Default-Start: 2 3 4 5 >>> # Default-Stop: 0 1 6 >>> # Short-Description: Start Motion detection >>> # Description: loads motion and assigns privileges >>> ### END INIT INFO >>> >>> # Ported to new debian way using sh and /lib/lsb/init-functions >>> # by Angel Carpintero<ac...@te...> >>> # Modified by : Juan Angulo Moreno<ju...@ap...> >>> # Eddy Petrisor<edd...@gm...> >>> # ArAge<Ar...@gm...> >>> >>> NAME=motion >>> PATH_BIN=/bin:/usr/bin:/sbin:/usr/sbin >>> DAEMON=/usr/bin/motion >>> PIDFILE=/var/run/$NAME.pid >>> DEFAULTS=/etc/default/$NAME >>> DESC="motion detection daemon" >>> >>> ENV="env -i LANG=C PATH=$PATH_BIN" >>> >>> . /lib/lsb/init-functions >>> >>> test -x $DAEMON || exit 0 >>> >>> RET=0 >>> >>> [ -r "$DEFAULTS" ]&& . "$DEFAULTS" || start_motion_daemon=yes >>> >>> >>> check_daemon_enabled () { >>> if [ "$start_motion_daemon" = "yes" ] ; then >>> return 0 >>> else >>> log_warning_msg "Not starting $NAME daemon, disabled via >>> /etc/default/$NAME" >>> return 1 >>> fi >>> >>> } >>> >>> >>> case "$1" in >>> start) >>> if check_daemon_enabled ; then >>> log_daemon_msg "Starting $DESC" "$NAME" >>> if start-stop-daemon --start --oknodo --exec $DAEMON -b --chuid >>> motion ; >>> then >>> log_end_msg 0 >>> else >>> log_end_msg 1 >>> RET=1 >>> fi >>> fi >>> ;; >>> >>> stop) >>> log_daemon_msg "Stopping $DESC" "$NAME" >>> if start-stop-daemon --stop --oknodo --exec $DAEMON --retry 30 ; >>> then >>> log_end_msg 0 >>> else >>> log_end_msg 1 >>> RET=1 >>> fi >>> ;; >>> >>> reload|force-reload) >>> log_daemon_msg "Reloading $NAME configuration" >>> if start-stop-daemon --stop --signal HUP --exec $DAEMON ; then >>> log_end_msg 0 >>> else >>> log_end_msg 1 >>> RET=1 >>> fi >>> ;; >>> >>> restart-motion) >>> if check_daemon_enabled ; then >>> log_action_begin_msg "Restarting $NAME" >>> if $0 stop&& $0 start ; then >>> log_action_end_msg 0 >>> else >>> log_action_cont_msg "(failed)" >>> RET=1 >>> fi >>> fi >>> ;; >>> >>> restart) >>> $0 restart-motion >>> ;; >>> >>> *) >>> echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload}" >>> RET=1 >>> ;; >>> esac >>> >>> >>> exit $RET >>> >>> >>> >>> >>> Am 27.07.2011 17:40, schrieb Andrew Burgess: >>>> On 07/27/2011 08:31:00 AM, Hendrik Friedel wrote: >>>> >>>>> I suppose there's the one or other User using motion under Debian, >>>>> here? >>>>> I have this problem: >>>>> crontab-l >>>>> 56 16 * * * whoami>/motionstartstop.log >>>>> 57 16 * * * /etc/init.d/motion start>>/motionstartstop.log >>>>> 59 16 * * * /etc/init.d/motion stop>>/motionstartstop.log >>>>> >>>>> cat /motionstartstop.log >>>>> root >>>>> Starting motion detection daemon: motion failed! >>>>> Stopping motion detection daemon: motion failed! >>>>> >>>>> >>>>> Also, starting motion without the init-scripts does not work, when >>>>> done >>>>> in the crontab. >>>>> >>>>> Any Ideas? >>>> you should also redirect stderr to the logfile (although cron on >>>> fedora will email you stderr if it gets written to; did you check >>>> root's mail?) >>>> >>>> this should do it: >>>> >>>> 57 16 * * * /etc/init.d/motion start>>/motionstartstop.log 2>&1 >>>> >>>> or try at a shell: >>>> >>>> /usr/bin/motion -n >>>> >>>> hth >>>> >>>> >>> ------------------------------------------------------------------------------ >>>> Got Input? Slashdot Needs You. >>>> Take our quick survey online. Come on, we don't ask for help often. >>>> Plus, you'll get a chance to win $100 to spend on ThinkGeek. >>>> http://p.sf.net/sfu/slashdot-survey >>>> _______________________________________________ >>>> Motion-user mailing list >>>> Mot...@li... >>>> https://lists.sourceforge.net/lists/listinfo/motion-user >>>> http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome >>> ------------------------------------------------------------------------------ >>> Got Input? Slashdot Needs You. >>> Take our quick survey online. Come on, we don't ask for help often. >>> Plus, you'll get a chance to win $100 to spend on ThinkGeek. >>> http://p.sf.net/sfu/slashdot-survey >>> _______________________________________________ >>> Motion-user mailing list >>> Mot...@li... >>> https://lists.sourceforge.net/lists/listinfo/motion-user >>> http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome >>> >>> >> ------------------------------------------------------------------------------ >> Got Input? Slashdot Needs You. >> Take our quick survey online. Come on, we don't ask for help often. >> Plus, you'll get a chance to win $100 to spend on ThinkGeek. >> http://p.sf.net/sfu/slashdot-survey >> _______________________________________________ >> Motion-user mailing list >> Mot...@li... >> https://lists.sourceforge.net/lists/listinfo/motion-user >> http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome > > > > ------------------------------------------------------------------------------ > Got Input? Slashdot Needs You. > Take our quick survey online. Come on, we don't ask for help often. > Plus, you'll get a chance to win $100 to spend on ThinkGeek. > http://p.sf.net/sfu/slashdot-survey > _______________________________________________ > Motion-user mailing list > Mot...@li... > https://lists.sourceforge.net/lists/listinfo/motion-user > http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome |