Project

General

Profile

Bug #160 » netservices.sh.diff

Alexander Eremin, 2010-09-06 04:30 AM

View differences:

usr/src/cmd/svc/shell/netservices.sh Mon Aug 30 23:48:20 2010 -0700 → usr/src/cmd/svc/shell/netservices.sh Mon Sep 06 14:16:09 2010 +0400
26 26
DT_CHANGED=0
27 27

  
28 28
LOG_FMRI=svc:/system/system-log
29
CMSD_FMRI=svc:/network/rpc/cde-calendar-manager
30 29
BIND_FMRI=svc:/network/rpc/bind
31 30
XSERVER_FMRI=svc:/application/x11/x11-server
32 31
SENDMAIL_FMRI=svc:/network/smtp:sendmail
......
36 35
CUPSRFC1179_FMRI=svc:/application/cups/in-lpd
37 36
IPPLISTENER_FMRI=svc:/application/print/ipp-listener
38 37
TTDB_FMRI=svc:/network/rpc/cde-ttdbserver
39
DTLOGIN_FMRI=svc:/application/graphical-login/cde-login
40
WEBCONSOLE_FMRI=svc:/system/webconsole
41
SMCWBEM_FMRI=svc:/application/management/wbem
42 38

  
43 39
usage()
44 40
{
......
87 83
	svcadm refresh $LOG_FMRI
88 84
}
89 85

  
90
set_cmsd()
91
{
92
	svcprop -q $CMSD_FMRI:default || return
93
	if [ "$1" = "local" ]; then
94
		proto="ticlts"
95
	else
96
		proto="udp"
97
	fi
98

  
99
	inetadm -m $CMSD_FMRI:default proto=$proto
100
	svcadm refresh $CMSD_FMRI:default
101
}
102

  
103 86
set_rpcbind()
104 87
{
105 88
	svcprop -q $BIND_FMRI || return
......
150 133
	svcadm refresh $TTDB_FMRI:tcp
151 134
}
152 135

  
153
set_dtlogin()
154
{
155
	svcprop -q $DTLOGIN_FMRI || return
156

  
157
	eval args=`svcprop -p dtlogin/args $DTLOGIN_FMRI`
158

  
159
	if echo $args | egrep -s udpPort 
160
	then
161
		old_port=`echo $args |
162
		    sed 's/.*-udpPort [ ]*\([0-9][0-9]*\).*/\1/'`
163
		new_args=`echo $args |
164
		    sed 's/\(.*\)-udpPort [0-9][0-9]*\(.*\)/\1\2/'`
165
	else
166
		old_port=-1
167
		new_args=$args
168
	fi
169

  
170
	if [ "$1" = "local" ]; then
171
		args="$new_args -udpPort 0"
172
		DT_CHANGED=1
173
	else
174
		# remove '-udpPort 0' argument. Leave intact if port != 0.
175
		if [ $old_port -eq 0 ]; then
176
			args="$new_args"
177
			DT_CHANGED=1
178
		fi
179
	fi
180

  
181
	svccfg -s $DTLOGIN_FMRI setprop dtlogin/args = "\"$args\""
182
	svcadm refresh $DTLOGIN_FMRI
183
}
184

  
185
set_webconsole() {
186
	svcprop -q $WEBCONSOLE_FMRI:console || return
187
	if [ "$1" = "local" ]; then
188
		val=false
189
	else
190
		val=true
191
	fi
192

  
193
	set_property $WEBCONSOLE_FMRI options tcp_listen $val
194
	svcadm refresh $WEBCONSOLE_FMRI
195
}
196

  
197
set_smcwbem() {
198
	svcprop -q $SMCWBEM_FMRI:default || return
199
	if [ "$1" = "local" ]; then
200
		val=false
201
	else
202
		val=true
203
	fi
204

  
205
	set_property $SMCWBEM_FMRI options tcp_listen $val
206
	svcadm refresh $SMCWBEM_FMRI
207
}
208

  
209 136
set_printing() {
210 137
	use_cups=`svcprop -C -p general/active $CUPSSERVER_FMRI:default \
211 138
		  2>/dev/null`
......
270 197
# set services
271 198
#
272 199
set_system_log $keyword
273
set_cmsd $keyword
274 200
set_rpcbind $keyword
275 201
set_xserver $keyword
276 202
set_sendmail $keyword
277 203
set_ttdbserver $keyword
278
set_dtlogin $keyword
279
set_webconsole $keyword
280
set_smcwbem $keyword
281 204
set_printing $keyword
282 205

  
283 206
#
......
314 237
	echo "restarting sendmail"
315 238
	svcadm restart $SENDMAIL_FMRI
316 239
fi
317

  
318
if [ "`svcprop -p restarter/state $SMCWBEM_FMRI:default`" = "online" ]
319
then
320
	# need restart since refresh won't pick up new command-line
321
	echo "restarting wbem"
322
	svcadm restart $SMCWBEM_FMRI:default
323
fi
324

  
325
if [ $DT_CHANGED -eq 1 ]; then
326
	if [ "`svcprop -p restarter/state $DTLOGIN_FMRI:default`" = "online" ]
327
	then
328
		r="y"
329
		if tty -s ; then
330
			printf \
331
			    "dtlogin needs to be restarted. Restart now? [Y] "
332
			read r
333
		fi
334
		if [ "$r" = "" -o "$r" = "y" -o "$r" = "Y" ]; then
335
			# Make sure we survive killing dtlogin...
336
			trap "" 15
337
			svcadm restart $DTLOGIN_FMRI 
338
			echo "restarting dtlogin"
339
		else
340
			printf "dtlogin not restarted. "
341
			printf "Restart it to put it in ${keyword}-mode.\n"
342
		fi
343
	fi
344
fi
(1-1/5)