X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=gdm.init;h=13ca65bfff5e1a5d0cee8c745374636cb2e9ce89;hb=3938ef44d2a3af5f3c07efcafb4bd0150660c4fc;hp=530c6da4a9781b9da21c2d2aa77957cbc1b042a2;hpb=eb18af7f44494369d7be860d9d8e120a2ae702e5;p=packages%2Fgdm.git diff --git a/gdm.init b/gdm.init index 530c6da..13ca65b 100644 --- a/gdm.init +++ b/gdm.init @@ -2,10 +2,10 @@ # # gdm: Starts the Gnome Display Manager # -# Version: @(#) /etc/rc.d/init.d/gdm 0.1 +# Version: @(#) /etc/rc.d/init.d/gdm 0.1 # -# chkconfig: 5 95 5 -# description: Starts and stops the Gnome Display Manager at startup and +# chkconfig: 5 95 05 +# description: Starts and stops the Gnome Display Manager at startup and \ # shutdown.. # # config: /etc/X11/gdm/gdm-config @@ -15,42 +15,72 @@ . /etc/rc.d/init.d/functions # Get service config -if [ -f /etc/sysconfig/gdm ] ; then - . /etc/sysconfig/gdm +if [ -f /etc/sysconfig/gdm ]; then + . /etc/sysconfig/gdm fi -# See how we were called. -case "$1" in - start) +start() { # Check if the service is already running? + if [ -f /var/lock/subsys/gdm ]; then + msg_already_running "Gnome Display Manager" + return + fi + + msg_starting "Gnome Display Manager" + start-stop-daemon --start -b --exec /usr/sbin/gdm + ok + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/gdm +} + +stop() { + if [ ! -f /var/lock/subsys/gdm ]; then + msg_not_running "Gnome Display Manager" + return + fi + + msg_stopping "Gnome Display Manager" + killproc gdm + rm -f /var/lock/subsys/gdm +} + +condrestart() { if [ ! -f /var/lock/subsys/gdm ]; then - msg_starting "Gnome Display Manager" - daemon /usr/X11R6/bin/gdm - RETVAL=$? - $RETVAL -eq 0 ] && touch /var/lock/subsys/gdm - else - msg_Already_Running "Gnome Display Manager" + msg_not_running "Gnome Display Manager" + RETVAL=$1 + return fi + + stop + start +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start ;; stop) - if [ -f /var/lock/subsys/gdm ]; then - msg_stopping "Gnome Display Manager" - killproc gdm - rm -f /var/lock/subsys/gdm - else - msg_Not_Running "Gnome Display Manager" - fi + stop ;; - status) - status gdm + restart) + stop + start + ;; + try-restart) + condrestart 0 ;; - restart|reload) - $0 stop - $0 start + force-reload) + condrestart 7 + ;; + status) + status gdm gdm-binary + RETVAL=$? ;; *) - echo "Usage: $0 {start|stop|status|restart|reload}" - exit 1 + msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" + exit 3 esac exit $RETVAL