1

I'm not a native english speaker, just in case... if you don't understand something please ask me.

I installed motion in my Raspberry pi B+ to use a web camera, when I run:

sudo service motion start

It works, and I can see my camera in the port 8081, but... after a few minutes the service goes active (exited) and I can't see my camera anymore.

I checked that with:

sudo service motion status

But then I restart it with:

sudo service motion restart

And it works again, but just for a few minutes.

¿Can someone help me with this?

4
  • I'd suggest starting it from the command line instead of systemd and see if it reports any errors at the shell window.
    – Kolban
    Commented May 15, 2016 at 4:38
  • Thank you @Kolban if I start it with <code>sudo /usr/bin/motion</code> It works, but I have to do this first: <code>sudo service motion stop</code> Now... How can I make it start on boot in this way...?
    – gloaiza
    Commented May 15, 2016 at 18:18
  • See the following video about starting a program at boot time. youtube.com/watch?v=eEuViHanjKI Use this or other procedures to start an arbitrary program at boot time. So ... ignore the fact that we are starting motion ... and start studying about how to start an arbitrary program at boot and we should be good
    – Kolban
    Commented May 15, 2016 at 22:27
  • Don't forget to mark an answer as accepted if it helped you solve your problem, as it will let others know that it is a valid solution Commented May 22, 2016 at 4:35

1 Answer 1

0

To make your command run at boot I recommend that you add it to the /etc/etc.local file which executes all commands inside of it on boot

  1. Open the /etc/rc.local file by using the following command:

    Sudo nano /etc/rc.local
    
  2. Enter the command that you wish to execute:

    sudo service motion start &
    

Note: you have to put the command before the last line in /etc/rc.local that contains: exit 0

  1. Reboot your Pi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.