1#! /bin/sh
2#
3# This is an init script for Familiar
4# Copy it to /etc/init.d/lircexecd and type
5# > update-rc.d lircexecd defaults 20
6# It must be started after lircd (and it does alphabetically :-)
7# irexec reads /etc/lircrc by default
8
9
10test -f /usr/bin/irexec || exit 0
11test -f /etc/lircrc || exit 0
12
13case "$1" in
14  start)
15    echo -n "Starting lircexec daemon: irexec"
16    start-stop-daemon --start --quiet --exec /usr/bin/irexec -- --daemon
17    echo "."
18    ;;
19  stop)
20    echo -n "Stopping lircexec daemon: irexec"
21    start-stop-daemon --stop --quiet --exec /usr/bin/irexec
22    echo "."
23    ;;
24  restart|force-restart)
25    echo -n "Stopping lircexec daemon: irexec"
26    start-stop-daemon --stop --quiet --exec /usr/bin/irexec
27    sleep 1
28    echo -n "Starting lircexec daemon: irexec"
29    start-stop-daemon --start --quiet --exec /usr/bin/irexec -- --daemon
30    echo "."
31    ;;
32  *)
33    echo "Usage: /etc/init.d/lircexec {start|stop|reload|restart|force-restart}"
34    exit 1
35esac
36
37exit 0
38