Posts: 4
Joined: Sun Jun 28, 2015 5:31 pm

Motion-MMAL Auto Start on Boot?

Tue Jul 07, 2015 4:35 am

Ok, I have searched and searched. I can't find whats wrong. I simply can't get mmal to run on boot. I have it working so when I log in and run ./startmotion it works just fine. I simply can't get it to run as a daemon.

In /etc/default/motion :

in /etc/motion.conf
daemon on

I even tried copying motion and motion-mmal as well as the conf to /etc and put this in /etc/rc.local
(sleep 10;su – pi -c "/etc/motion-mmal -n -c /etc/motion.conf")&

As I said, I can log in as pi and run ./startmotion from the mmal directory and it runs fine. I just can't get it to start the daemon.

Could some kind soul give me a step by step on how to get this running at power on without having to ssh in and start it manually? Please.

Posts: 24
Joined: Thu Jan 03, 2013 12:32 am
Location: Hawick

Re: Motion-MMAL Auto Start on Boot?

Wed Jul 15, 2015 6:15 pm

I start motion with a cron job

Edit the root cron job file:-
sudo crontab -e

add the line:-
@reboot motion

save and exit (ctrl+x, then Y to confirm changes)

It should work if you have the motion daemon enabled.

Posts: 1
Joined: Fri Jun 16, 2017 9:22 am

Re: Motion-MMAL Auto Start on Boot?

Fri Jun 16, 2017 9:33 am

Not need to edit cron job file.
Simply ensure that the /etc/default/motion file is written with the right character encoding, or check that there are no blank spaces at the end of the file. The file must have only two rows with no blank spaces at the end of the string, otherwise the autostart daemon don't recognize it and fail to load.
It's useful to download on windows desktop the /etc/default/motion file, edit it with Notepad++ and reupload on rapsberry pi.

I did this and now works fine!

Return to “Camera board”