svc-legacy-routing revision a192e900f6d2b0e1a822e3252c0dfd795ed49d76
2441N/A#!/sbin/sh
2441N/A#
2441N/A# CDDL HEADER START
2441N/A#
2441N/A# The contents of this file are subject to the terms of the
2441N/A# Common Development and Distribution License (the "License").
2441N/A# You may not use this file except in compliance with the License.
2441N/A#
2441N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2441N/A# or http://www.opensolaris.org/os/licensing.
2441N/A# See the License for the specific language governing permissions
2441N/A# and limitations under the License.
2441N/A#
2441N/A# When distributing Covered Code, include this CDDL HEADER in each
2441N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2441N/A# If applicable, add the following below this CDDL HEADER, with the
2441N/A# fields enclosed by brackets "[]" replaced with your own identifying
2441N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2441N/A#
2441N/A# CDDL HEADER END
2441N/A#
2441N/A#
3817N/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
2441N/A# Use is subject to license terms.
2441N/A#
2441N/A# ident "%Z%%M% %I% %E% SMI"
2441N/A
2441N/A# This script is the shared method script for the legacy ipv4/ipv6
4081N/A# routing services.
2441N/A
2441N/A. /lib/svc/share/smf_include.sh
2441N/A
2441N/Adaemon_prog=`/usr/sbin/svccfg -s $SMF_FMRI listprop routeadm/daemon | \
4081N/A /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
2441N/A /usr/bin/nawk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
2441N/Adaemon_args=`/usr/sbin/svccfg -s $SMF_FMRI listprop routeadm/daemon-args | \
2441N/A /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
4081N/A /usr/bin/nawk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
2899N/Adaemon_stop=`/usr/sbin/svccfg -s $SMF_FMRI listprop routeadm/daemon-stop-cmd | \
3817N/A /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
3817N/A /usr/bin/nawk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
3817N/A
2441N/Amethod="$1"
2441N/Aproto="$2"
2441N/A
2441N/Acase "$method" in
2441N/A'start' )
2441N/A # No legacy daemon specified.
2441N/A if [ -z "$daemon_prog" ]; then
2441N/A echo "${proto}-routing-daemon not specified by routeadm."
2441N/A exit $SMF_EXIT_ERR_CONFIG
4557N/A fi
4557N/A # No legacy stop command specified.
4557N/A if [ -z "$daemon_stop" ]; then
4557N/A echo "${proto}-routing-stop-cmd not specified by routeadm."
4557N/A exit $SMF_EXIT_ERR_CONFIG
4557N/A fi
4557N/A smf_is_globalzone || exit $SMF_EXIT_OK
4557N/A
4557N/A # Run daemon - fail if it does not successfully daemonize.
4557N/A eval "$daemon_prog $daemon_args"
4557N/A if [ "$?" != "0" ]; then
4557N/A echo "Error: $daemon $daemon_args failed to daemonize."
4557N/A exit $SMF_EXIT_ERR_FATAL
4557N/A fi
4557N/A # Create pidfile.
4557N/A daemon_name=`/usr/bin/basename $daemon_prog`
2441N/A /usr/bin/pgrep -P 1 -f $daemon_prog > /var/tmp/${daemon_name}.pid
2441N/A ;;
3477N/A'stop' )
3477N/A smf_is_globalzone || exit $SMF_EXIT_OK
2441N/A
2441N/A # Stop daemon - ignore result.
2441N/A if [ -n "$daemon_stop" ]; then
2441N/A eval "$daemon_stop"
2441N/A fi
2441N/A ;;
4557N/A'*' )
4337N/A echo "Usage: $0 { start | stop }"
2441N/A exit $SMF_EXIT_ERR_FATAL
3817N/A ;;
3817N/Aesac
3817N/A
3817N/Aexit "$SMF_EXIT_OK"
3817N/A