[techtalk] Direct boot

Judith Bush jeb at grey-cat.com
Sun Jan 30 11:21:32 EST 2000



For a kiosk i have built, i have this script in /etc/init.d/ so the
machine goes straight to the user interface upon boot. It's nothing
fancy and certainly could be cleaned up. The essentail line is:

    su - kiosk -c startx &

in which root su's to the user and executes the command to start the X 
interface.

Note how to use inet.d in whatever distribution you have, so the script 
runs at boot. In Debian see /etc/init.d/README &
http://localhost/doc/debian-policy/.


Cheers,

judith


#! /usr/bin/tcsh
#########1#########2#########3#########4#########5#########6#########7#########8
#
#  Science Pulse configuration file. This file is copyright 1999 The Franklin
#          Institute Science Museum. <http://www.fi.edu> 
#          By Judith E. Bush <bush at grey-cat.com>
#
#  $Header$
#  $Log$
#
#  BUGS: 
#
#########1#########2#########3#########4#########5#########6#########7#########8

# skeleton      example file to build /etc/init.d/ scripts.
#               This file should be used to construct scripts for /etc/init.d.
#
#               Written by Miquel van Smoorenburg <miquels at cistron.nl>.
#               Modified for Debian GNU/Linux
#               by Ian Murdock <imurdock at gnu.ai.mit.edu>.
#
# Version:      @(#)skeleton  1.8  03-Mar-1998  miquels at cistron.nl
#

set PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
##DAEMON=/usr/sbin/daemon
set NAME=kiosk
set DESC="kiosk auto boot"

## test -f $DAEMON || exit 0

##set -e

switch ( $1 )
  case "start":
    echo -n "Starting ${DESC}: "

    su - kiosk -c startx &; echo $! >! /var/run/$NAME.pid
    #start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
    #           --exec $DAEMON
    echo "$NAME."
    breaksw
  case "stop":
    echo -n "Stopping $DESC: "
        #start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
        #       --exec $DAEMON
        kill -12 `cat /var/run/$NAME.pid`
    echo "$NAME."
    breaksw
  #case "reload":
        #
        #       If the daemon can reload its config files on the fly
        #       for example by sending it SIGHUP, do it here.
        #
        #       If the daemon responds to changes in its config file
        #       directly anyway, make this a do-nothing entry.
        #
        # echo "Reloading $DESC configuration files."
        # start-stop-daemon --stop --signal 1 --quiet --pidfile \
        #       /var/run/$NAME.pid --exec $DAEMON
    #breaksw
  case "restart":
        #
        #       If the "reload" option is implemented, move the "force-reload"
        #       option to the "reload" entry above. If not, "force-reload" is
        #       just the same as "restart".
        #
    echo -n "Restarting $DESC: "
    kill -12 `cat /var/run/$NAME.pid` 
    su - kiosk -c startx &; echo $! >! /var/run/$NAME.pid
#       start-stop-daemon --stop --quiet --pidfile \
#               /var/run/$NAME.pid --exec $DAEMON
#       sleep 1
#       start-stop-daemon --start --quiet --pidfile \
#               /var/run/$NAME.pid --exec $DAEMON
    echo "$NAME."
    breaksw
  default:
    set N=/etc/init.d/$NAME
        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
    echo "Usage: $N {start|stop}" >&2
    exit (1)
    breaksw
endsw 

exit 

************
techtalk at linuxchix.org   http://www.linuxchix.org




More information about the Techtalk mailing list