
Tengo un servidor web con motion v 4.0, pero el movimiento no se inicia al arrancar, tengo que decirle que se inicie cada vez y sudo motion -b
luego todo está bien hasta que necesito reiniciar. Intenté editar los archivos de configuración /etc/motion/motion.conf
y /etc/defualt/motion
para incluir la variable: start_motion_daemon=yes
¿cuál se supone que inicia el proceso en el arranque?
pero el proceso nunca se ejecuta cuando voy a comprobarlo. Intenté configurar rc.local, pero parece que Ubuntu ya no lo hace.
Intenté habilitar el servicio con 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
pero el servicio nunca se habilita, ni siquiera se activa. entonces miré en los registros:
[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)
Al leer los registros, pensaría que el proceso se está ejecutando, pero no es así.
Por sugerencia, intenté configurar un trabajo cron, ejecutar sudo crontab -e
y agregar la línea @reboot/usr/bin/motion -b
pero al reiniciar, el demonio de movimiento todavía no se ejecuta.
Solo quiero saber la forma moderna de iniciar este proceso al arrancar. Ubuntu 18.04, LXDE.
Respuesta1
puedes usar cron @reboot
sudo crontab -e
y agrega la linea
@reboot /path/to/bin/motion -b
Respuesta2
Primero, intenta ejecutarlo manualmente con sudo -u motion motion
. Si funciona, entonces el problema lo causa systemd.
Esto es contrario a la intuición, pero con systemd deberías configurar daemon off
motion.conf.
PD: /etc/defualt/motion
Probablemente el archivo no sea necesario en Ubuntu/Debian.