xref: /titanic_50/usr/src/cmd/avs/rdc/etc/rdcfinish.sh (revision 694c35faa87b858ecdadfe4fc592615f4eefbb07)
1#!/bin/sh
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Second SNDR start script
26# - called after the TCP/IP stack has been initialised,
27#   and networking enabled.
28#
29# - should be linked to /etc/rc2.d/S72rdcfinish as follows:
30#
31#       ln /etc/init.d/rdc /etc/rc2.d/S72rdcfinish
32#
33PATH=/etc:/bin
34RDCD="/usr/lib/sndrd"
35RDCSYNCD="/usr/lib/sndrsyncd"
36USAGE="Usage: $0 start"
37
38. /lib/svc/share/smf_include.sh
39
40case "$1" in
41'start')
42	echo "Completing SNDR startup:\c"
43
44	##
45	##	Start sndrd
46	##
47
48	if [ ! -f ${RDCD} ]
49 	then
50		echo "Cannot find ${RDCD}.\nSNDR services unavailable." > /dev/console
51		exit $SMF_EXIT_MON_OFFLINE
52	fi
53
54	ps -e | grep sndrd > /dev/null 2>&1
55	if [ $? -ne 0 ]; then
56		${RDCD}
57		echo  " sndrd\c"
58	else
59		echo " sndrd already enabled\c"
60	fi
61
62	##
63	##	Start sndrsyncd
64	##
65
66	if [ ! -f ${RDCSYNCD} ]
67 	then
68 		echo "\nCannot find ${RDCSYNCD}.\nSNDR start aborted." > /dev/console
69		exit $SMF_EXIT_MON_OFFLINE
70	fi
71
72	ps -e | grep sndrsyn > /dev/null 2>&1
73	if [ $? -ne 0 ]; then
74		${RDCSYNCD}
75		echo  " sndrsyncd\c"
76	else
77		echo " sndrsyncd already running\c"
78	fi
79
80	echo " done"
81	;;
82'stop')
83	# Inserted for symmetry
84	;;
85*)
86	echo $USAGE
87	exit 1
88	;;
89esac
90exit $SMF_EXIT_OK
91