我正在開發 Raspbian Jessie,我按如下方式編寫了我的新貴腳本本教程。這是我的/etc/init/videostream.conf
腳本文件。
# RPI Camera Service
description "RPICAM streaming"
author "My Name "
start on filesystem or runlevel [2345]
stop on shutdown or runlevel [016]
respawn
respawn limit 2 5
env HOME=/etc/default
umask 007
usage "videostream {start|stop|status|restart}"
script
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export HOME="/etc/default"
echo $$ > /var/run/videostream.pid
exec /etc/default/videostream >/dev/null 2>&1 &
end script
post-start script
echo "[`date`] videostream is Started" >> /var/log/videostream.log
end script
pre-start script
echo "[`date`] videostream Starting" >> /var/log/videostream.log
end script
pre-stop script
rm /var/run/videostream.pid
killall -w -q raspivid
killall -w -q ffmpeg
echo "[`date`] videostream Stopping" >> /var/log/videostream.log
end script
我使用安裝新貴sudo apt-get install upstart
。
重新啟動系統後,服務啟動良好且運作正常。問題是,重新啟動後直到系統正常運作,您無法停止該服務或啟動它。
當詢問狀態時,您會得到以下資訊:
sudo service videostream status
# Result
videostream stop/waiting
但是該服務正在工作,因為我可以看到流,並且根據日誌文件,一切似乎都正常,除非該服務在啟動時已啟動兩次。這是日誌檔案的一部分。
[Mon Jun 27 08:00:12 UTC 2016] videostream Starting
[Mon Jun 27 08:00:13 UTC 2016] videostream is Started
[Mon Jun 27 08:00:13 UTC 2016] videostream Starting
[Mon Jun 27 08:00:13 UTC 2016] videostream is Started
當我嘗試啟動該服務時,我得到以下資訊:
sudo service videostream start
# Result
start: Job failed to start
請問有人可以幫助我嗎?我真的不知道有什麼問題。