Linux

LIRC 重啟後不啟動

  • July 28, 2013

如果我編譯 LIRC,this patched lirc然後使用它進行安裝,make install它工作正常並且啟動時沒有任何錯誤。但是,重新啟動後,相同的命令失敗並出現以下錯誤:

root@NAS:~# lircd --device=/dev/ttyACM0 --driver=usb_irtoy
lircd: can't open or create /var/run/lirc/lircd.pid
lircd: No such file or directory
root@NAS:~#

任何想法可能是什麼原因?

好的,我找到了解決方案。我們需要/var/run/lirc/在每次啟動時手動創建目錄。我編輯了 lirc init.d腳本,如下所示,如果目錄不存在,則使用 code 創建目錄[ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"

#! /bin/sh
#
# This is an init script for Debian 2.1 Slink distribution.
# Copy it to /etc/init.d/lirc and type
# > update-rc.d lirc defaults 20
#


test -f /usr/local/sbin/lircd || exit 0
test -f /usr/local/sbin/lircmd || exit 0

case "$1" in
 start)
   [ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
   echo -n "Starting lirc daemon: lircd"
   start-stop-daemon --start --quiet --exec /usr/local/sbin/lircd -- --listen --driver=usb_irtoy --device=/dev/ttyACM0
   echo -n " lircmd"
   start-stop-daemon --start --quiet --exec /usr/local/sbin/lircmd
   echo "."
   ;;
 stop)
   echo -n "Stopping lirc daemon: lircmd"
   start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircmd
   echo -n " lircd"
   start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircd
   echo "."
   ;;
 reload|force-reload)
   start-stop-daemon --stop --quiet --signal 1 --exec /usr/local/sbin/lircd
   start-stop-daemon --stop --quiet --signal 1 --exec /usr/local/sbin/lircmd
   ;;
 restart)
   echo -n "Stopping lirc daemon: lircmd"
   start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircmd
   echo " lircd"
   start-stop-daemon --start --quiet --exec /usr/local/sbin/lircd -- --listen --driver=usb_irtoy --device=/dev/ttyACM0
   sleep 1
   echo -n "Starting lirc daemon: lircd"
   start-stop-daemon --start --quiet --exec /usr/local/sbin/lircd -- --listen --driver=usb_irtoy --device=/dev/ttyACM0
   echo -n " lircmd"
   start-stop-daemon --start --quiet --exec /usr/local/sbin/lircmd
   echo "."
   ;;
 *)
   echo "Usage: /etc/init.d/lircd {start|stop|reload|restart|force-reload}"
   exit 1
esac

exit 0

引用自:https://unix.stackexchange.com/questions/84612