
Eu tenho um servidor web com motion v 4.0, mas o motion não inicia na inicialização, tenho que avisar para iniciar sempre e sudo motion -b
tudo fica bem até que eu precise reiniciar. Eu tentei editar os arquivos de configuração /etc/motion/motion.conf
e /etc/defualt/motion
para incluir a variável: start_motion_daemon=yes
qual deve iniciar o processo na inicialização?
mas o processo nunca funciona quando vou verificar. Tentei configurar o rc.local, mas parece que o Ubuntu não está mais fazendo isso?
Tentei habilitar o serviço com systemctl:
sudo systemctl enable motion
motion.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable motion
mas o serviço nunca é ativado ou mesmo ativado. então olhei nos logs:
[1:ml1] [NTC] [VID] [Jun 16 07:26:10] v4l2_get_capability: - VIDEO_CAPTURE
[1:ml1] [NTC] [VID] [Jun 16 07:26:10] v4l2_get_capability: - STREAMING
[1:ml1] [NTC] [VID] [Jun 16 07:26:10] v4l2_select_input: name = "Camera 1", type 0x00000002, status 00000000
[0:web_control] [NTC] [STR] [Jun 16 07:26:10] http_bindsock: error binding on 127.0.0.1 port 8080
[1:ml1] [NTC] [VID] [Jun 16 07:26:10] v4l2_select_input: - CAMERA
[0:web_control] [NTC] [STR] [Jun 16 07:26:10] motion_web_control: motion-httpd thread exit
[1:ml1] [ERR] [VID] [Jun 16 07:26:10] v4l2_select_input: Error selecting input 0 VIDIOC_S_INPUT: Device or resource busy
[1:ml1] [NTC] [VID] [Jun 16 07:26:10] vid_v4lx_start: Using V4L1
[1:ml1] [NTC] [ALL] [Jun 16 07:26:10] image_ring_resize: Resizing pre_capture buffer to 1 items
[1:ml1] [ERR] [ALL] [Jun 16 07:26:20] motion_init: Error capturing first image
[1:ml1] [NTC] [STR] [Jun 16 07:26:20] http_bindsock: error binding on any IPv4 address port 8081
[1:ml1] [ERR] [ALL] [Jun 16 07:26:20] motion_init: Problem enabling motion-stream server in port 8081: Address already in use
[1:ml1] [NTC] [ALL] [Jun 16 07:26:20] motion_loop: Thread exiting
[1:ml1] [NTC] [VID] [Jun 16 07:26:20] vid_close: Closing video device /dev/video0
[0:motion] [NTC] [ALL] [Jun 16 07:26:21] main: Motion thread 1 restart
[1:ml1] [NTC] [ALL] [Jun 16 07:26:21] motion_init: Camera 0 started: motion detection Enabled
[1:ml1] [NTC] [VID] [Jun 16 07:26:21] vid_v4lx_start: Using videodevice /dev/video0 and input -1
[1:ml1] [NTC] [VID] [Jun 16 07:26:21] v4l2_get_capability:
------------------------
cap.driver: "uvcvideo"
cap.card: "HD Webcam C615"
cap.bus_info: "usb-ff540000.usb-1.1"
cap.capabilities=0x84200001
------------------------
[1:ml1] [NTC] [VID] [Jun 16 07:26:21] v4l2_get_capability: - VIDEO_CAPTURE
[1:ml1] [NTC] [VID] [Jun 16 07:26:21] v4l2_get_capability: - STREAMING
[1:ml1] [NTC] [VID] [Jun 16 07:26:21] v4l2_select_input: name = "Camera 1", type 0x00000002, status 00000000
[1:ml1] [NTC] [VID] [Jun 16 07:26:21] v4l2_select_input: - CAMERA
[1:ml1] [ERR] [VID] [Jun 16 07:26:21] v4l2_select_input: Error selecting input 0 VIDIOC_S_INPUT: Device or resource busy
[1:ml1] [NTC] [VID] [Jun 16 07:26:21] vid_v4lx_start: Using V4L1
[1:ml1] [NTC] [ALL] [Jun 16 07:26:21] image_ring_resize: Resizing pre_capture buffer to 1 items
(END)
lendo os logs, acho que o processo está em execução, mas não está.
Por sugestão, tentei configurar um cron job, executando sudo crontab -e
e adicionando a linha @reboot/usr/bin/motion -b
mas na reinicialização, o daemon de movimento ainda não está em execução.
Eu só quero saber a maneira moderna de iniciar esse processo na inicialização. Ubuntu 18.04, LXDE.
Responder1
você pode usar cron @reboot
sudo crontab -e
e adicione a linha
@reboot /path/to/bin/motion -b
Responder2
Primeiro, tente executá-lo manualmente com sudo -u motion motion
. Se funcionar, o problema é causado pelo systemd.
Isso é contra-intuitivo, mas com o systemd você deve ativar daemon off
o motion.conf.
PS: O arquivo /etc/defualt/motion
provavelmente não é necessário no Ubuntu/Debian.