在/lib下的systemd创建mjpg_streamer服务
sudo nano /lib/systemd/system/mjpg_streamer.service
然后将如下内容copy进去
[Unit]
Description=A server for streaming Motion-JPEG from a video capture device
After=network.target
[Service]
ExecStart=/usr/local/bin/mjpg_streamer -i "/usr/local/lib/mjpg-streamer/input_uvc.so -d /dev/video0" -o "/usr/local/lib/mjpg-streamer/output_http.so -w /usr/local/share/mjpg-streamer/www"
[Install]
WantedBy=multi-user.target
想让此服务生效的前提是编译mjpg-streamer后并执行sudo make install
然后:
sudo systemctl enable mjpg_streamer
reboot 生效