Comment 10 for bug 294852

Revision history for this message
Darren Conway (darren-conway) wrote :

I have server version 12.04 installed with the same bug. I tried the fix in Post 4 and got the following results. Motion is started but then dies.

darren@alpha:~$ pgrep motion
darren@alpha:~$ sudo /etc/init.d/motion restart
[sudo] password for darren:
 * Restarting motion...
* Stopping motion detection daemon motion
No /usr/bin/motion found running; none killed.
                                                                                                                      [ OK ]
 * Starting motion detection daemon : motion
* Starting motion detection daemon motion [ OK ]
                                                                                                                      [ OK ]
darren@alpha:~$ pgrep motion
1245
darren@alpha:~$ pgrep motion

Motioin died after about 10-15 seconds.
No images are produced so Motion doesn't get very far before disappearing.
The original /etc/init.d/motion file included the following:

case "$1" in
  start)
    if check_daemon_enabled ; then
        if ! [ -d /var/run/motion ]; then
                mkdir /var/run/motion
        fi
        chown motion:motion /var/run/motion

        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
    ;;

The modified file (based on posting 4) looks like the following:

case "$1" in
  start)
    if check_daemon_enabled ; then
        log_daemon_msg "Starting motion detection daemon : $NAME"
        ### BEGIN /var/run Fix
        MOTIONPIDDIR=/var/run/motion
        if ! [ -d $MOTIONPIDDER ]; then
             mkdir -p $MOTIONPIDDER
        chown root:motion /var/run/motion
        chmod 775 $MOTIONPIDDIR
        fi

        ### END /var/run Fix
        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
    ;;

I tried running the script with the chmod and chown outside the < if start..... if> but that didn't work.