All pastes #41903 Raw Edit

Stuff

public text v1 · immutable
#41903 ·published 2006-02-17 00:28 UTC
rendered paste body
---[/etc/init.d/lircd]---
#!/bin/sh
#
# $Id: lircd.init,v 1.1 2002/09/28 11:54:12 dude Exp $
# Startup script for the Linux Infrared Remote Control.
#
# chkconfig: - 90 10
# description: Enables infrared controls through LIRC.
#
# config: /etc/lircd.conf

# Source 'em up
. /etc/init.d/functions

[ -x /usr/sbin/lircd ]  || exit 1
[ -x /usr/sbin/lircmd ] || exit 1
[ -f /etc/lircd.conf ]  || [ -f /etc/lircmd.conf ] || exit 1

[ -f /etc/sysconfig/lircd ] && . /etc/sysconfig/lircd

RETVAL=0

start(){
        if [ -f /etc/lircd.conf ]; then
                echo -n $"Starting infrared remote control daemon: "
                daemon lircd $LIRCD_OPTIONS
                RETVAL=$?
                echo
        fi
        if [ -f /etc/lircmd.conf ]; then
                echo -n $"Starting infrared remote control mouse daemon: "
                daemon lircmd
                RETVAL=$?
                echo
        fi
        touch /var/lock/subsys/lircd
        return $RETVAL
}

stop(){
        if [ -f /etc/lircmd.conf ]; then
                echo -n $"Stopping infrared remote control mouse daemon: "
                killproc lircmd
                echo
        fi
        if [ -f /etc/lircd.conf ]; then
                echo -n $"Stopping infrared remote control daemon: "
                killproc lircd
                echo
        fi
        RETVAL=$?
        rm -f /var/lock/subsys/lircd
        return $RETVAL
}

restart(){
        stop
        start
}


# See how we were called.
case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                restart
                ;;
        status)
                status lircd
                ;;
        condrestart)
                [ -e /var/lock/subsys/lircd ] && restart
                ;;
        *)
                echo $"Usage: $0 {start|stop|status|restart|condrestart}"
                RETVAL=1
esac

exit $RETVAL
---[end /etc/init.d/lircd]---

---[/etc/sysconfig/lircd]---
# Options to lircd
LIRCD_OPTIONS="--device=/dev/lirc0"
---[end /etc/sysconfig/lircd]---