Listing 1. Basic devfsd Startup Script

#!/bin/sh
# devfsd startup script

DEVFSD=/sbin/devfsd
MOUNTPOINT=/dev

PID='pidof $DEVFSD'

case "$1" in
  start)
        echo -n "Starting devfsd: "
        if [ ! -e $MOUNTPOINT/.devfsd ] ; then
                mount -t devfs none $MOUNTPOINT
        fi

        if [ "$PID" ] ; then
                echo "already runing"
        else
                $DEVFSD $MOUNTPOINT > /dev/null 2>&1 &
                echo "devfsd"
        fi
        ;;
  stop)
        echo -n "Stopping devfsd: "
        if [ "$PID" ] ; then
                kill $PID
                echo "devfsd"
        else
                echo "devfsd not running"
        fi
        ;;
  restart)
        echo -n "Restarting devfsd: "
        if [ "$PID" ] ; then
                kill $PID
                echo "devfsd"
        fi
        sleep 1
        $DEVFSD $MOUNTPOINT > /dev/null 2>&1 &
        echo "devfsd"
        ;;
  *)
        echo "Usage: /etc/init.d/devfsd  {start|stop|restart}" >&2
        exit 1
        ;;
esac

exit 0