web-dev-qa-db-fra.com

le serveur de mouvement ne démarre pas

J'ai un serveur Web avec motion v 4.0, mais la motion ne démarre pas au démarrage, je dois lui dire de démarrer à chaque fois avec Sudo motion -b alors tout est cool jusqu'à ce que je doive redémarrer. J'ai essayé d'éditer les fichiers de configuration, /etc/motion/motion.conf et /etc/defualt/motion

inclure la variable: start_motion_daemon=yes qui est supposé démarrer le processus au démarrage?

mais le processus ne tourne jamais quand je vais le vérifier. J'ai essayé de configurer rc.local, mais il semble que Ubuntu ne le fasse plus?

J'ai essayé d'activer le service avec 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

mais le service n'est jamais activé, ni même activé. alors j'ai regardé dans les journaux:

[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)

en lisant les journaux, je penserais que le processus est en cours, mais ce n’est pas le cas.

Par suggestion, j'ai essayé de configurer un travail cron, en exécutant Sudo crontab -e et en ajoutant la ligne @reboot /usr/bin/motion -b

mais au redémarrage, le démon motion ne fonctionne toujours pas ..

Je veux juste connaître la manière moderne de démarrer ce processus au démarrage. Ubuntu 18.04, LXDE.

1
j0h

vous pouvez utiliser cron @reboot

Sudo crontab -e

et ajouter la ligne

@reboot   /path/to/bin/motion -b
1
cmak.fr