]> spindle.queued.net Git - autox/blob - debian/autox.init
abe83a039b77393454dfa4c3c235dbc5691d80d6
[autox] / debian / autox.init
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides:          autox
4 # Required-Start:    $local_fs $remote_fs
5 # Required-Stop:     $local_fs $remote_fs
6 # Default-Start:     2 3 4 5
7 # Default-Stop:      0 1 6
8 # Short-Description: Automatically start X on boot
9 ### END INIT INFO
10 #
11 # Author:            Andres Salomon <dilinger@debian.org> 
12 #
13
14 set -e
15
16 PATH=/sbin:/bin:/usr/sbin:/usr/bin
17 DAEMON=/usr/sbin/autox
18 PIDFILE=/var/run/autox.pid
19 NAME=autox
20 DESC=autox
21
22 test -x $DAEMON || exit 0
23
24 . /lib/lsb/init-functions
25
26 AUTOX_USER=""
27 if [ -f /etc/default/$NAME ] ; then
28         . /etc/default/$NAME
29 fi
30
31 if [ -z "$AUTOX_USER" ]; then
32         log_failure_msg "No user specified in /etc/default/${NAME}."
33 fi
34
35 case "$1" in
36  start)
37         log_daemon_msg "Starting $DESC" "$NAME"
38 #x=$(readlink -f /dev/stdin)
39 #echo "stdin: $x" > /tmp/blah
40 #chown olpc /dev/tty7
41 # -- /dev/tty7
42         #start-stop-daemon --start --chuid olpc --verbose --background --make-pidfile --pidfile $PIDFILE --user olpc --exec $DAEMON -- /dev/tty7
43 #start-stop-daemon --start --verbose --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- /dev/tty7
44         start-stop-daemon --start --background --pidfile $PIDFILE \
45                         --exec $DAEMON
46
47         #start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS &
48         log_end_msg $?
49         ;;
50  stop)
51         log_daemon_msg "Stopping $DESC" "$NAME"
52         start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
53         log_end_msg $?
54         ;;
55  restart|force-reload)
56         $0 stop
57         sleep 1
58         $0 start
59         ;;
60  *)
61         N=/etc/init.d/$NAME
62         echo "Usage: $N {start|stop|restart|force-reload}" >&2
63         exit 1
64         ;;
65 esac
66
67 exit 0