如何设置 Motion 来访问我复制的配置文件?

如何设置 Motion 来访问我复制的配置文件?

正如建议的本教程我在 ~/.motion/motion.conf 下的主文件夹中复制了 Motion 配置文件。但 Motion 仍然尝试访问 /etc/motion/motion.conf 下的配置文件。我该如何解决这个问题?

这是我启动 Motion 时得到的结果:

nuc@nuc:~$ motion
[0] **could not open configfile /etc/motion/motion.conf: Permission denied**
[0] Not config file to process using default values
[0] Motion 3.2.12 Started
[0] ffmpeg LIBAVCODEC_BUILD 3547904 LIBAVFORMAT_BUILD 3544067
[1] Thread 1 started
[1] Failed to open video device /dev/video0: No such file or directory
[1] Could not fetch initial image from camera
[1] Motion continues using width and height from config file(s)
[1] Resizing pre_capture buffer to 1 items
[1] Retrying until successful connection with camera
[1] Failed to open video device /dev/video0: No such file or directory

答案1

您可以使用 -c 选项告诉 Motion 使用不同的配置文件。例如,如果我正在进行一些更改,我通常会复制我的motion.conf文件,命名为test.motion.conf,并通过以下命令使用它:

运动-c /home/b/motion/test.motion.conf

您可以在开发人员的网站上找到有关命令行选项的更多信息。为了命令行选项请点击这里

编辑:

我可能对用于 Motion 的家中服务器进行了一些不寻常的更改。因此,作为测试,我只是将其安装在我的笔记本电脑上。

sudo apt-get install motion
mkdir /home/b/scripts/motion
sudo cp /etc/motion/motion.conf /home/b/scripts/motion/test.motion.conf
sudo chown b:b /home/b/scripts/motion/test.motion.conf


$ motion -c /home/b/scripts/motion/test.motion.conf
[0] Processing thread 0 - config file /home/b/scripts/motion/test.motion.conf
[0] Motion 3.2.12 Started
[0] ffmpeg LIBAVCODEC_BUILD 3547904 LIBAVFORMAT_BUILD 3544067
[0] Thread 1 is from /home/b/scripts/motion/test.motion.conf
[1] Thread 1 started
...

我不确定你的配置是什么样的。也许您正在尝试以守护进程模式运行它。或者,如果您复制了该文件,它可能仍将 root 指定为所有者。您可以尝试运行它,然后查看 /var/log/syslog 以了解导致错误的原因。或者,您可以尝试将您的用户添加到运动团体。

相关内容