Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 5cfb5dbb4f1d624752ccf195b0a5a9d2 > files > 8

autodir-0.99.9-9.fc12.src.rpm

#!/bin/sh
#
# autohome Creates user home directories on demand
#
# chkconfig: - 28 72
# description: Autohome creates user home directories in a transparent \
#              manner. It relies on the autofs protocol for its operation.

### BEGIN INIT INFO
# Provides: autohome
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Creates user home directories on demand
# Description: Autohome creates user home directories in a transparent manner.
#    It relies on the autofs protocol for its operation.
### END INIT INFO

# Source function library.
. /etc/init.d/functions

exec="/usr/sbin/autodir"
prog="autohome"

[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

lockfile=/var/lock/subsys/$prog

start() {
    [ -x $exec ] || exit 5
    [ -f $config ] || exit 6
    # If module is not loaded, load it now
    grep -q autofs4 /proc/modules || /sbin/modprobe -k autofs4 &>/dev/null
    # Now start autodir for autohome
    echo -n $"Starting $prog: "
    daemon $exec -d $AUTOHOME_HOME -m $AUTOHOME_MODULE \
        ${AUTOHOME_OPTIONS+"-o $AUTOHOME_OPTIONS"} \
        ${AUTOHOME_TIMEOUT+"-t $AUTOHOME_TIMEOUT"} \
        ${AUTOHOME_BACKUP+"-b $AUTOHOME_BACKUP"} \
        ${AUTOHOME_BACKWAIT+"-w $AUTOHOME_BACKWAIT"} \
        ${AUTOHOME_BACKPRI+"-p $AUTOHOME_BACKPRI"} \
        ${AUTOHOME_MAXBACK+"-c $AUTOHOME_MAXBACK"} \
        -l /var/run/$prog.pid 2>/dev/null
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    killproc $prog
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    stop
    start
}

reload() {
    restart
}

force_reload() {
    restart
}

rh_status() {
    status $prog
}

rh_status_q() {
    rh_status &>/dev/null
}


case "$1" in
    start)
        rh_status_q && exit 0
        $1
        ;;
    stop)
        rh_status_q || exit 0
        $1
        ;;
    restart)
        $1
        ;;
    reload)
        rh_status_q || exit 7
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        rh_status
       ;;
    condrestart|try-restart)
        rh_status_q || exit 0
        restart
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
        exit 2
esac
exit $?