components/lighttpd/Solaris/http-lighttpd14
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 517 4da3f450475b
permissions -rw-r--r--
Close of build 10.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
331
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     1
#!/usr/bin/ksh93
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     2
#
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     3
# CDDL HEADER START
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     4
#
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     8
#
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    12
# and limitations under the License.
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    13
#
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    19
#
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    20
# CDDL HEADER END
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    21
#
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    22
#
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    23
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    24
#
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    25
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    26
source /lib/svc/share/smf_include.sh
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    27
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    28
# constants
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    29
typeset -r lighttpd_version="1.4"
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    30
typeset -r lighttpd_home="/usr/lighttpd/${lighttpd_version}"
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    31
typeset -r lighttpd_bin="${lighttpd_home}/sbin/lighttpd"
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    32
typeset -r conf_file="/etc/lighttpd/${lighttpd_version}/lighttpd.conf"
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    33
typeset -r pidfile=`sed -n -e 's/"//g' -e 's/server\.pid-file *= *//p' ${conf_file}`
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    34
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    35
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    36
[[ ! -f "${conf_file}" ]] && exit $SMF_EXIT_ERR_CONFIG
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    37
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    38
case "$1" in
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    39
        start)
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    40
                rm -f "${pidfile}"
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    41
                exec ${lighttpd_bin} -f ${conf_file} 2>&1
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    42
                ;;
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    43
        refresh)
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    44
                print "Going to refresh"
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    45
                if [[ -f "${pidfile}" ]]; then
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    46
                        kill -HUP "$( < "${pidfile}" )"
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    47
                fi
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    48
                ;;
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    49
        stop)
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    50
                if [[ -f ${pidfile} ]] ; then
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    51
                        kill "$( < "${pidfile}" )"
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    52
                fi
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    53
                ;;
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    54
        *)
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    55
                printf "Usage: %s {start|stop|refresh}\n" "$0"
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    56
                exit 1
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    57
                ;;
5001b63ddc8a 7057442 Move Lighttpd to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    58
esac