Print this page
XXX Remove nawk(1)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/cmd-inet/usr.sbin/routeadm/svc-legacy-routing
+++ new/usr/src/cmd/cmd-inet/usr.sbin/routeadm/svc-legacy-routing
1 1 #!/sbin/sh
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22 #
23 23 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
26 -# ident "%Z%%M% %I% %E% SMI"
27 26
28 27 # This script is the shared method script for the legacy ipv4/ipv6
29 28 # routing services.
30 29
31 30 . /lib/svc/share/smf_include.sh
32 31
33 32 daemon_prog=`/usr/sbin/svccfg -s $SMF_FMRI listprop routeadm/daemon | \
34 - /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
35 - /usr/bin/nawk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
33 + /usr/xpg4/bin/awk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
34 + /usr/xpg4/bin/awk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
36 35 daemon_args=`/usr/sbin/svccfg -s $SMF_FMRI listprop routeadm/daemon-args | \
37 - /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
38 - /usr/bin/nawk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
36 + /usr/xpg4/bin/awk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
37 + /usr/xpg4/bin/awk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
39 38 daemon_stop=`/usr/sbin/svccfg -s $SMF_FMRI listprop routeadm/daemon-stop-cmd | \
40 - /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
41 - /usr/bin/nawk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
39 + /usr/xpg4/bin/awk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
40 + /usr/xpg4/bin/awk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
42 41
43 42 method="$1"
44 43 proto="$2"
45 44
46 45 case "$method" in
47 46 'start' )
48 47 # No legacy daemon specified.
49 48 if [ -z "$daemon_prog" ]; then
50 49 echo "${proto}-routing-daemon not specified by routeadm."
51 50 exit $SMF_EXIT_ERR_CONFIG
52 51 fi
53 52 # No legacy stop command specified.
54 53 if [ -z "$daemon_stop" ]; then
55 54 echo "${proto}-routing-stop-cmd not specified by routeadm."
56 55 exit $SMF_EXIT_ERR_CONFIG
57 56 fi
58 57 smf_configure_ip || exit $SMF_EXIT_OK
59 58
60 59 # Run daemon - fail if it does not successfully daemonize.
61 60 eval "$daemon_prog $daemon_args"
62 61 if [ "$?" != "0" ]; then
63 62 echo "Error: $daemon $daemon_args failed to daemonize."
64 63 exit $SMF_EXIT_ERR_FATAL
65 64 fi
66 65 # Create pidfile.
67 66 daemon_name=`/usr/bin/basename $daemon_prog`
68 67 if smf_is_globalzone; then
69 68 /usr/bin/pgrep -P 1 -z `smf_zonename` -f $daemon_prog > \
70 69 /var/tmp/${daemon_name}.pid
71 70 else
72 71 /usr/bin/pgrep -z `smf_zonename` -f $daemon_prog > \
73 72 /var/tmp/${daemon_name}.pid
74 73 fi
75 74 ;;
76 75 'stop' )
77 76 smf_configure_ip || exit $SMF_EXIT_OK
78 77
79 78 # Stop daemon - ignore result.
80 79 if [ -n "$daemon_stop" ]; then
81 80 eval "$daemon_stop"
82 81 fi
83 82 ;;
84 83 '*' )
85 84 echo "Usage: $0 { start | stop }"
86 85 exit $SMF_EXIT_ERR_FATAL
87 86 ;;
88 87 esac
89 88
90 89 exit "$SMF_EXIT_OK"
↓ open down ↓ |
39 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX