16

I have recently get to set up motion with my RPi but I have a problem which is simple one one hand, but, on the other, can’t find any step-by-step instructions to remedy it.

Although I have successfully set up motion and works, after I've made all the necessary tweaks to run it in daemon (edited etc/default/motion & etc/motion/motion.conf), I still can’t get it to start in daemon mode. That said, with every restart of the Pi. I have to manually start the script by “sudo service motion start” or "sudo motion". I know it is an issue with permissions that motion needs to start in daemon but as a complete newbie in the PiWorld, I would appreciate if anyone could guide me through to the 2-3 necessary commands to fix it.

Steve Robillard
  • 34,687
  • 17
  • 103
  • 109
gtj
  • 161
  • 1
  • 1
  • 4

2 Answers2

27

To enable motion to run as a daemon on startup do the following:

Edit /etc/default/motion

and change start_motion_daemon=no to start_motion_daemon=yes

Next enable motion by entering the following at the command line:

sudo systemctl enable motion

Finally reboot.

You can confirm motion is running by checking the output from the following command:

sudo service motion status
Steve Robillard
  • 34,687
  • 17
  • 103
  • 109
  • It really was that simple. Thankfully, it seems the Jessie version simplified things a bit. I had been messing with chown chmod 777 sudo cd and other commands to change ownership to the directory motion uses to run. All these were apparently needed in older versions. Thank you so much Steve! I appreciate it. Cheers! – gtj Jan 19 '16 at 20:46
  • You don't need to use chown or chmod if you use sudo to run motion. This is good because people won't be able to delete the motion files without a sudo user password. Also, I would not recommend using 777 because then, anyone can delete the motion files. – mchid Sep 25 '19 at 05:26
  • This answer seems no longer useful. It seems there is no such file (nano reports that it is a new file) – Thomas Weller Feb 26 '22 at 16:34
3

Confirmed for stretch (v9) as well.

you can also use

$ ps -ef | grep motion

to see if motion is running

Bigdadda06
  • 91
  • 1
  • 5