xref: /illumos-gate/usr/src/cmd/vntsd/svc-vntsd (revision 4d39be2b)
11ae08745Sheppo#!/sbin/sh
21ae08745Sheppo#
31ae08745Sheppo# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
41ae08745Sheppo# Use is subject to license terms.
51ae08745Sheppo#
61ae08745Sheppo# CDDL HEADER START
71ae08745Sheppo#
81ae08745Sheppo# The contents of this file are subject to the terms of the
91ae08745Sheppo# Common Development and Distribution License (the "License").
101ae08745Sheppo# You may not use this file except in compliance with the License.
111ae08745Sheppo#
121ae08745Sheppo# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
131ae08745Sheppo# or http://www.opensolaris.org/os/licensing.
141ae08745Sheppo# See the License for the specific language governing permissions
151ae08745Sheppo# and limitations under the License.
161ae08745Sheppo#
171ae08745Sheppo# When distributing Covered Code, include this CDDL HEADER in each
181ae08745Sheppo# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
191ae08745Sheppo# If applicable, add the following below this CDDL HEADER, with the
201ae08745Sheppo# fields enclosed by brackets "[]" replaced with your own identifying
211ae08745Sheppo# information: Portions Copyright [yyyy] [name of copyright owner]
221ae08745Sheppo#
231ae08745Sheppo# CDDL HEADER END
241ae08745Sheppo#
251ae08745Sheppo# ident	"%Z%%M%	%I%	%E% SMI"
261ae08745Sheppo#
271ae08745Sheppo# Start script for vntsd
281ae08745Sheppo#
291ae08745Sheppo# For modifying parameters passed to vntsd, do not edit
301ae08745Sheppo# this script. Instead use svccfg(1m) to modify the SMF
311ae08745Sheppo# repository. For example:
321ae08745Sheppo#
331ae08745Sheppo# svccfg
341ae08745Sheppo# svc:> select ldoms/vntsd
351ae08745Sheppo# svc:/ldoms/vntsd> setprop vntsd/vcc_device = "virtual-console-concentrator@1"
361ae08745Sheppo# svc:/ldoms/vntsd> setprop vntsd/listen_addr = "192.168.1.1"
371ae08745Sheppo# svc:/ldoms/vntsd> exit
381ae08745Sheppo
391ae08745Sheppo. /lib/svc/share/smf_include.sh
401ae08745Sheppo
411ae08745Sheppovcc_device=`svcprop -p vntsd/vcc_device $SMF_FMRI 2>/dev/null`
421ae08745Sheppoif [ -z "$vcc_device" ]; then
431ae08745Sheppo	vcc_device="virtual-console-concentrator@0"
441ae08745Sheppofi
451ae08745Sheppoargs="-i $vcc_device"
461ae08745Sheppo
471ae08745Sheppolisten_addr=`svcprop -p vntsd/listen_addr $SMF_FMRI 2>/dev/null`
481ae08745Sheppoif [ -n "$listen_addr" ]; then
491ae08745Sheppo	args="$args -p $listen_addr"
501ae08745Sheppofi
511ae08745Sheppo
521ae08745Sheppotimeout=`svcprop -p vntsd/timeout_minutes $SMF_FMRI 2>/dev/null`
531ae08745Sheppoif [ -n "$timeout" ]; then
541ae08745Sheppo	args="$args -t $timeout"
551ae08745Sheppofi
561ae08745Sheppo
571ae08745Sheppoif [ -x /usr/lib/ldoms/vntsd ]; then
58*4d39be2bSsg    /usr/lib/ldoms/vntsd $args
59*4d39be2bSsg    rc=$?
60*4d39be2bSsg    if [ $rc -ne 0 ]; then
61*4d39be2bSsg	# if vntsd exited in error with status 1, let SMF restart it
62*4d39be2bSsg	# otherwise we want it to go into maintenance.
63*4d39be2bSsg	if [ $rc -eq 1 ]; then
64*4d39be2bSsg	    exit $SMF_ERR_OTHER
65*4d39be2bSsg	else
66*4d39be2bSsg	    exit $SMF_ERR_FATAL
67*4d39be2bSsg	fi
68*4d39be2bSsg    fi
691ae08745Sheppoelse
701ae08745Sheppo    echo "WARNING: /usr/lib/ldoms/vntsd is missing or not executable" >& 2
711ae08745Sheppo    exit $SMF_EXIT_ERR_CONFIG
721ae08745Sheppofi
731ae08745Sheppo
741ae08745Sheppoexit $SMF_EXIT_OK
75