source: pkg/main/distro-defaults/trunk/20hal @ 1855

Revision 1427, 1.9 KB checked in by alanbach-guest, 7 years ago (diff)

distro-defaults updates

  • Property svn:executable set to *
Line 
1#! /bin/sh
2#
3# hal           Start the Daemon that stores device informations
4#               for the Hardware abstraction layer
5#
6#               Written by Martin Waitz based on skeleton code
7#               written by Miquel van Smoorenburg <miquels@cistron.nl>.
8#               Modified for Debian
9#               by Ian Murdock <imurdock@gnu.ai.mit.edu>.
10#
11
12PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
13DAEMON=/usr/sbin/hald
14PIDDIR=/var/run/hal
15PIDFILE=$PIDDIR/hald.pid
16NAME=hald
17DAEMONUSER=haldaemon
18DESC="Hardware abstraction layer"
19
20. /lib/lsb/init-functions
21
22test -x $DAEMON || exit 0
23
24# Include hal defaults if available
25if [ -f /etc/default/hal ] ; then
26        . /etc/default/hal
27fi
28
29set -e
30
31do_start() {
32  if [ ! -d $PIDDIR ]; then
33    mkdir -p $PIDDIR
34    chown $DAEMONUSER:$DAEMONUSER $PIDDIR
35  fi
36        log_daemon_msg "Starting $DESC" "$NAME"
37        start-stop-daemon --start --pidfile $PIDFILE \
38                --exec $DAEMON -- $DAEMON_OPTS
39        log_end_msg $?
40}
41
42do_stop() {
43        log_daemon_msg "Stopping $DESC" "$NAME"
44        start-stop-daemon --stop --oknodo --quiet --pidfile $PIDFILE \
45                --exec $DAEMON
46        log_end_msg $?
47}
48
49case "$1" in
50  start)
51    do_start
52        ;;
53  stop)
54    do_stop
55        ;;
56  #reload)
57        #
58        #       If the daemon can reload its config files on the fly
59        #       for example by sending it SIGHUP, do it here.
60        #
61        #       If the daemon responds to changes in its config file
62        #       directly anyway, make this a do-nothing entry.
63        #
64        # echo "Reloading $DESC configuration files."
65        # start-stop-daemon --stop --signal 1 --quiet --pidfile \
66        #       /var/run/$NAME.pid --exec $DAEMON
67  #;;
68  restart|force-reload)
69        #
70        #       If the "reload" option is implemented, move the "force-reload"
71        #       option to the "reload" entry above. If not, "force-reload" is
72        #       just the same as "restart".
73        #
74  do_stop
75        sleep 5
76  do_start
77        ;;
78  *)
79        N=/etc/init.d/$NAME
80        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
81        log_success_msg "Usage: $N {start|stop|restart|force-reload}" >&2
82        exit 1
83        ;;
84esac
85
86exit 0
Note: See TracBrowser for help on using the repository browser.