xref: /illumos-gate/usr/src/cmd/vntsd/svc-vntsd (revision 6a1073f89079df9576bccd94a24df8c011db8169)
1#!/sbin/sh
2#
3# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
4# Use is subject to license terms.
5#
6# CDDL HEADER START
7#
8# The contents of this file are subject to the terms of the
9# Common Development and Distribution License (the "License").
10# You may not use this file except in compliance with the License.
11#
12# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13# or http://www.opensolaris.org/os/licensing.
14# See the License for the specific language governing permissions
15# and limitations under the License.
16#
17# When distributing Covered Code, include this CDDL HEADER in each
18# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19# If applicable, add the following below this CDDL HEADER, with the
20# fields enclosed by brackets "[]" replaced with your own identifying
21# information: Portions Copyright [yyyy] [name of copyright owner]
22#
23# CDDL HEADER END
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27# Start script for vntsd
28#
29# For modifying parameters passed to vntsd, do not edit
30# this script. Instead use svccfg(1m) to modify the SMF
31# repository. For example:
32#
33# svccfg
34# svc:> select ldoms/vntsd
35# svc:/ldoms/vntsd> setprop vntsd/vcc_device = "virtual-console-concentrator@1"
36# svc:/ldoms/vntsd> setprop vntsd/listen_addr = "192.168.1.1"
37# svc:/ldoms/vntsd> exit
38
39. /lib/svc/share/smf_include.sh
40
41vcc_device=`svcprop -p vntsd/vcc_device $SMF_FMRI 2>/dev/null`
42if [ -z "$vcc_device" ]; then
43	vcc_device="virtual-console-concentrator@0"
44fi
45args="-i $vcc_device"
46
47listen_addr=`svcprop -p vntsd/listen_addr $SMF_FMRI 2>/dev/null`
48if [ -n "$listen_addr" ]; then
49	args="$args -p $listen_addr"
50fi
51
52timeout=`svcprop -p vntsd/timeout_minutes $SMF_FMRI 2>/dev/null`
53if [ -n "$timeout" ]; then
54	args="$args -t $timeout"
55fi
56
57if [ -x /usr/lib/ldoms/vntsd ]; then
58    /usr/lib/ldoms/vntsd $args
59    rc=$?
60    if [ $rc -ne 0 ]; then
61	# if vntsd exited in error with status 1, let SMF restart it
62	# otherwise we want it to go into maintenance.
63	if [ $rc -eq 1 ]; then
64	    exit $SMF_ERR_OTHER
65	else
66	    exit $SMF_ERR_FATAL
67	fi
68    fi
69else
70    echo "WARNING: /usr/lib/ldoms/vntsd is missing or not executable" >& 2
71    exit $SMF_EXIT_ERR_CONFIG
72fi
73
74exit $SMF_EXIT_OK
75