Motion Server startet nicht

Motion Server startet nicht

Ich habe einen Webserver mit Motion v 4.0, aber Motion startet nicht beim Booten. Ich muss es jedes Mal starten lassen, sudo motion -bdann ist alles cool, bis ich neu starten muss. Ich habe versucht, die Konfigurationsdateien zu bearbeiten, /etc/motion/motion.confund /etc/defualt/motion

um die Variable einzubinden: start_motion_daemon=yes welche den Prozess beim Booten starten soll?

aber der Prozess läuft nie, wenn ich ihn überprüfen will. Ich habe versucht, rc.local einzurichten, aber es scheint, als würde Ubuntu das nicht mehr tun?

Ich habe versucht, den Dienst mit systemctl zu aktivieren:

sudo systemctl enable motion
motion.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable motion

aber der Dienst wird nie aktiviert oder auch nur eingeschaltet. Also habe ich in den Protokollen nachgesehen:

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

beim Lesen der Protokolle würde ich annehmen, dass der Prozess ausgeführt wird, aber das tut er nicht.

Auf Vorschlag habe ich versucht, einen Cron-Job einzurichten, auszuführen sudo crontab -e und die Zeile @reboot hinzuzufügen/usr/bin/motion -b

aber beim Neustart läuft der Motion Daemon immer noch nicht.

Ich möchte nur wissen, wie dieser Vorgang beim Booten auf moderne Weise gestartet werden kann. Ubuntu 18.04, LXDE.

Antwort1

Sie können cron @reboot verwenden

sudo crontab -e

und fügen Sie die Zeile hinzu

@reboot   /path/to/bin/motion -b

Antwort2

Versuchen Sie zunächst, es manuell mit auszuführen sudo -u motion motion. Wenn dies funktioniert, wird das Problem durch systemd verursacht.

Dies ist kontraintuitiv, aber mit systemd sollten Sie daemon offmotion.conf festlegen.

PS: Die Datei /etc/defualt/motionwird in Ubuntu/Debian wahrscheinlich nicht benötigt.

verwandte Informationen