Welcome! Log In Create A New Profile

Advanced

Debian on Pogoplug Oxnas CPU - how to start Motion on boot

Posted by Eric 
Hello,
I have Debian Squeeze installed on a Pogoplug Pro (Oxnas arm6). I installed Motion on it, and it runs ok. But, how do I make Motion start at boot? I tried the following, but no luck:

update-rc.d motion defaults

Thanks!
Re: Debian on Pogoplug Oxnas CPU - how to start Motion on boot
October 20, 2013 03:50AM
Is there a start script for motion in "/etc/init.d/" ?
If not, the command you posted can't ever work.
Hi,
Yes, there is a start-up script in the <etc/init.d> folder labeled "motion". It looks something like this:

#!/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 <ack@telefonica.net>
# Modified by : Juan Angulo Moreno <juan@apuntale.com>
#               Eddy Petrisor <eddy.petrisor@gmail.com>
#               ArAge <ArAge@gmx.co.uk>
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/$$
        return 1
    fi

}

It's longers, but I can't copy multipages. Is there something I'm suppose to do to the automatically generated init.d Motion file?
Re: Debian on Pogoplug Oxnas CPU - how to start Motion on boot
October 20, 2013 01:08PM
Did the update-rc.d command create the corresponding links in the /etc/rcX.d/ folders, too?
If not, something went wong and that's why it doesn't start. You probably should try to start motion once manually first by running "/etc/init.d/motion start". That's in order to see if the script in /etc/init.d/ does work at all.

If this works, starting it automatically when starting up the system should probably also work. Most likely it's nothing big.
Hi - thanks for answering my questions.

Yes, "motion" exists in </etc/rc0.d> and </etc/rc1.d> as "K01motion".

I tried starting it manually by running " /etc/init.d/motion start", and I get the following:

Not starting motion daemon, disabled via /etc/default/motion ... (warning).

Looking into </etc/default/motion>, this was what was wrong:

# set to 'yes' to enable the motion daemon
start_motion_daemon=no

Changing the "no" to "yes" fixed the problem. Thanks for the tip.

In general, can I run any program on start-up by simply typing in "update-rc.d ProgramName defaults" into the console, and then looking for the ProgramName in the </etc/default/ProgramName> entry to make sure daemon is set to yes?
Re: Debian on Pogoplug Oxnas CPU - how to start Motion on boot
October 21, 2013 03:27PM
Eric Wrote:
-------------------------------------------------------
>...
> In general, can I run any program on start-up by
> simply typing in "update-rc.d ProgramName
> defaults" into the console, and then looking for
> the ProgramName in the </etc/default/ProgramName>
> entry to make sure daemon is set to yes?

I don't know if I understand your question correctly.
In general it works like this:
The "update-rc.d" command only creates the links in "/etc/rc"runlevel".d/", according to the settings in the script files, located in the "/etc/init.d/" folder. You can manually specify what runlevels to start and/or stop the script in, if you use the corresponding parameters, other than "defaults". The "defaults" setting uses what's written in the header in the script file itself.
If a package does not provide such a init-script, you can create it yourself. Default location for these scripts is "/etc/init.d/".
Every script there has some options, like "start", "stop", "restart".
And of course you can manually run those scripts, in order to see if they work, or not. ;-)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: