components/lighttpd/Solaris/http-lighttpd14
branchs11u1-sru
changeset 3190 44a15b136f48
parent 3189 29f154187658
child 3191 59fa2e6aecea
equal deleted inserted replaced
3189:29f154187658 3190:44a15b136f48
     1 #!/usr/bin/ksh93
       
     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 # Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
       
    24 #
       
    25 
       
    26 source /lib/svc/share/smf_include.sh
       
    27 
       
    28 # constants
       
    29 typeset -r lighttpd_version="1.4"
       
    30 typeset -r lighttpd_home="/usr/lighttpd/${lighttpd_version}"
       
    31 typeset -r lighttpd_bin="${lighttpd_home}/sbin/lighttpd"
       
    32 typeset -r conf_file="/etc/lighttpd/${lighttpd_version}/lighttpd.conf"
       
    33 typeset -r pidfile=`sed -n -e 's/"//g' -e 's/server\.pid-file *= *//p' ${conf_file}`
       
    34 
       
    35 
       
    36 [[ ! -f "${conf_file}" ]] && exit $SMF_EXIT_ERR_CONFIG
       
    37 
       
    38 case "$1" in
       
    39         start)
       
    40                 rm -f "${pidfile}"
       
    41                 exec ${lighttpd_bin} -f ${conf_file} 2>&1
       
    42                 ;;
       
    43         refresh)
       
    44                 print "Going to refresh"
       
    45                 if [[ -f "${pidfile}" ]]; then
       
    46                         kill -HUP "$( < "${pidfile}" )"
       
    47                 fi
       
    48                 ;;
       
    49         stop)
       
    50                 if [[ -f ${pidfile} ]] ; then
       
    51                         kill "$( < "${pidfile}" )"
       
    52                 fi
       
    53                 ;;
       
    54         *)
       
    55                 printf "Usage: %s {start|stop|refresh}\n" "$0"
       
    56                 exit 1
       
    57                 ;;
       
    58 esac