]> spindle.queued.net Git - autox/blob - debian/autox.init
Initial commit
[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 as a user
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 --exec $DAEMON
45
46         #start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS &
47         log_end_msg $?
48         ;;
49  stop)
50         log_daemon_msg "Stopping $DESC" "$NAME"
51         start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
52         log_end_msg $?
53         ;;
54  restart|force-reload)
55         $0 stop
56         sleep 1
57         $0 start
58         ;;
59  *)
60         N=/etc/init.d/$NAME
61         echo "Usage: $N {start|stop|restart|force-reload}" >&2
62         exit 1
63         ;;
64 esac
65
66 exit 0