#!/bin/sh # # lirc Startup script for the Linux Infrared Remote Control daemons # # chkconfig: - 29 71 # description: Enables infrared controls through LIRC. # processname: lircd # processname: lircmd # config: /etc/lircd.conf # config: /etc/lircmd.conf # pidfile: /var/run/lircd.pid # Source function library. . /etc/init.d/functions exec="/usr/sbin/lircd" exec2="/usr/sbin/lircmd" prog=$(basename $exec) prog2=$(basename $exec2) [ -e /etc/sysconfig/lirc ] && . /etc/sysconfig/lirc lockfile=/var/lock/subsys/lirc start() { echo -n $"Starting infrared remote control daemon ($prog): " daemon $exec $LIRCD_OPTIONS retval=$? echo status $prog >/dev/null 2>&1 if [ $? -eq 0 -a "$ENABLE_LIRCMD" = "yes" ] ; then echo -n $"Starting infrared remote control mouse daemon ($prog2): " daemon $exec2 $LIRCMD_OPTIONS retval=$? echo fi [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { retval=0 if status $prog2 >/dev/null 2>&1 ; then echo -n $"Stopping infrared remote control mouse daemon ($prog2): " killproc $prog2 retval=$? echo fi if [ $retval -eq 0 ] ; then echo -n $"Stopping infrared remote control daemon ($prog): " killproc $prog retval=$? echo fi [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { stop start } reload() { # lircmd doesn't apparently respond to HUP, so if it's running, restart. if status $prog2 >/dev/null 2>&1 ; then restart else echo -n $"Reloading infrared remote control daemon ($prog): " killproc $prog -HUP retval=$? echo return $retval fi } case "$1" in start|stop|restart|reload) $1 ;; force-reload) reload || restart ;; status) status $prog2 status $prog ;; try-restart|condrestart) [ ! -f $lockfile ] || restart ;; *) echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}" exit 2 esac