Magellan Linux

Contents of /trunk/magellan-initscripts/etc/rc.d/init.d/xdm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 71 - (show annotations) (download)
Tue Mar 15 19:07:56 2005 UTC (19 years, 1 month ago) by niro
File size: 1923 byte(s)
updated header and fixed whitespaces

1 #!/bin/bash
2 # $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/xdm,v 1.4 2005-03-15 19:07:56 niro Exp $
3
4 #%rlevels: 5:s 0:k 1:k 2:k 3:k 4:k 6:k
5 #%start: 95
6 #%stop: 05
7
8 #deps
9 #%needs:
10 #%before:
11 #%after:
12
13 source /etc/sysconfig/rc
14 source $rc_functions
15 source /etc/rc.config
16 source /etc/profile
17
18 if [ -z ${GLOGIN} ]
19 then
20 echo "You have to declare \"GLOGIN\" in /etc/rc.conf !"
21 exit 1
22 fi
23
24 XDM_OPT=$1
25
26 get_login() {
27 case "$GLOGIN" in
28 kdm|KDM)
29 GLOGINCMD="$(which kdm 2> /dev/null)"
30 if [ ! -f "${GLOGINCMD}" ]
31 then
32 echo "Failure: KDE Login Manager not found."
33 exit 1
34 fi
35 ;;
36 gdm|GDM)
37 if [[ ${XDM_OPT} = stop ]]
38 then
39 GLOGINCMD="$(which gdm-binary 2> /dev/null)"
40 else
41 GLOGINCMD="$(which gdm 2> /dev/null)"
42 fi
43 if [ ! -f "${GLOGINCMD}" ]
44 then
45 echo "Failure: KDE Login Manager not found."
46 exit 1
47 fi
48 ;;
49 xdm|XDM)
50 GLOGINCMD="$(which xdm 2> /dev/null)"
51 if [ ! -f "${GLOGINCMD}" ]
52 then
53 echo "Failure: XDM Login Manager not found."
54 exit 1
55 fi
56 ;;
57 *)
58 GLOGINCMD="$(which ${GLOGIN} 2> /dev/null)"
59 if [ ! -f "${GLOGINCMD}" ]
60 then
61 echo "Failure: \"${GLOGIN}\" Login Manager not found."
62 exit 1
63 fi
64 esac
65 }
66
67 case "${XDM_OPT}" in
68 start)
69 get_login
70 echo -e ${COLOREDSTAR}"Starting ${GLOGIN} ..."
71 /sbin/telinit a
72 evaluate_retval
73
74 update_svcstatus $1
75 splash svc_started "$(basename $0)" 0
76 ;;
77 stop)
78 get_login
79 if [ -n "$(ps -A|grep $(basename ${GLOGINCMD}))" ]
80 then
81 echo -e ${COLOREDSTAR}"Stopping ${GLOGIN} ..."
82
83 CUR_VT=$(fgconsole)
84 start-stop-daemon --stop --quiet --exe ${GLOGINCMD}
85 evaluate_retval
86 chvt ${CUR_VT}
87 fi
88 update_svcstatus $1
89 splash svc_stopped "$(basename $0)" 0
90 ;;
91
92 restart)
93 $0 stop
94 sleep 1
95 $0 start
96 ;;
97 status)
98 get_login
99 statusproc ${GLOGINCMD}
100 ;;
101 *)
102 echo "Usage: $0 {start|stop|restart|status}"
103 exit 1
104 ;;
105 esac

Properties

Name Value
svn:executable *