components/puppet/files/puppet_master
changeset 1409 9db4ba32e740
parent 1408 8bc5df437e67
child 1410 ca9946e5736c
equal deleted inserted replaced
1408:8bc5df437e67 1409:9db4ba32e740
     1 #!/usr/bin/ksh -p
       
     2 #
       
     3 # CDDL HEADER START
       
     4 #
       
     5 # The contents of this file are subject to the terms of the
       
     6 # Common Development and Distribution License (the "License").
       
     7 # You may not use this file except in compliance with the License.
       
     8 #
       
     9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
    10 # or http://www.opensolaris.org/os/licensing.
       
    11 # See the License for the specific language governing permissions
       
    12 # and limitations under the License.
       
    13 #
       
    14 # When distributing Covered Code, include this CDDL HEADER in each
       
    15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    16 # If applicable, add the following below this CDDL HEADER, with the
       
    17 # fields enclosed by brackets "[]" replaced with your own identifying
       
    18 # information: Portions Copyright [yyyy] [name of copyright owner]
       
    19 #
       
    20 # CDDL HEADER END
       
    21 #
       
    22 
       
    23 #
       
    24 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
       
    25 #
       
    26 
       
    27 # Load SMF constants and functions
       
    28 . /lib/svc/share/smf_include.sh
       
    29 
       
    30 # Establish PATH for non-built in commands
       
    31 export PATH=/usr/bin:/usr/sbin
       
    32 
       
    33 case "$1" in
       
    34 'start')
       
    35 	# handles startup of puppet master
       
    36 
       
    37 	flags=""
       
    38 
       
    39 	#
       
    40 	# retrieve the server property.  If the variable is left
       
    41 	# empty, do not add the --server flag to the CLI
       
    42 	#
       
    43 	server=$(svcprop -p config/server $SMF_FMRI)
       
    44 	if [[ $? -eq 0 ]] && [[ "$server" != '' ]]; then
       
    45 		flags+=" --server $server"
       
    46 	fi
       
    47 
       
    48 	# retrieve the logfile property.
       
    49 	logdest=$(svcprop -p config/logdest $SMF_FMRI)
       
    50 	if [[ "$logdest" != '' ]]; then
       
    51 		flags+=" --logdest $logdest"
       
    52 	fi
       
    53 
       
    54 	cmd="puppet master ${flags}"
       
    55 	exec $cmd
       
    56 
       
    57 	;;
       
    58 *)
       
    59 	echo "Usage: $0 { start }"
       
    60 	exit $SMF_EXIT_ERR_CONFIG
       
    61 	;;
       
    62 esac
       
    63 exit $SMF_EXIT_OK