#!/bin/bash #%rlevels: 5:s 0:k 1:k 2:k 3:k 4:k 6:k #%start: 95 #%stop: 05 #deps #%needs: #%before: #%after: source /etc/sysconfig/rc source $rc_functions source /etc/rc.config source /etc/profile if [ -z ${GLOGIN} ] then echo "You have to declare \"GLOGIN\" in /etc/rc.conf !" exit 1 fi get_login() { case "$GLOGIN" in kdm|KDM) GLOGINCMD="$(which kdm 2> /dev/null)" if [ ! -f "${GLOGINCMD}" ] then echo "Failure: KDE Login Manager not found." exit 1 fi ;; xdm|XDM) GLOGINCMD="$(which xdm 2> /dev/null)" if [ ! -f "${GLOGINCMD}" ] then echo "Failure: XDM Login Manager not found." exit 1 fi ;; *) GLOGINCMD="$(which ${GLOGIN} 2> /dev/null)" if [ ! -f "${GLOGINCMD}" ] then echo "Failure: \"${GLOGIN}\" Login Manager not found." exit 1 fi esac } case "$1" in start) get_login echo -e ${COLOREDSTAR}"Starting ${GLOGIN} ..." /sbin/telinit a evaluate_retval update_svcstatus $1 splash svc_started "$(basename $0)" 0 ;; stop) get_login if [ -n "$(ps -A|grep $(basename ${GLOGINCMD}))" ] then echo -e ${COLOREDSTAR}"Stopping ${GLOGIN} ..." #killproc ${GLOGINCMD} CUR_VT=$(fgconsole) start-stop-daemon --stop --quiet --exe ${GLOGINCMD} evaluate_retval chvt ${CUR_VT} fi update_svcstatus $1 splash svc_started "$(basename $0)" 0 ;; restart) $0 stop sleep 1 $0 start ;; status) get_login statusproc ${GLOGINCMD} ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac