swi-prolog: update to 9.2.9
[oi-userland.git] / components / web / nginx / files / nginx-startup.sh
blobe2f594353277f7dbdd8edd66e72b7f97f910e26e
1 #!/bin/sh
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL)". You may
6 # only use this file in accordance with the terms of the CDDL.
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright 2011 EveryCity Ltd. All rights reserved.
17 . /lib/svc/share/smf_include.sh
19 # Set a reasonable ulimit
20 ulimit -n 65535
22 # Allow more than 256 file descriptors on Solaris 10 32bit
23 # See the following URL for a full description:
24 # http://developers.sun.com/solaris/articles/stdio_256.html
25 # export LD_PRELOAD_32=/usr/lib/extendedFILE.so.1
27 NGINX_USR_ROOT=/usr
28 NGINX_ETC_ROOT=/etc/nginx
30 STARTUP_OPTIONS=
32 PLATFORM_DIR=
34 getprop() {
35 PROPVAL=""
36 svcprop -q -p $1 ${SMF_FMRI}
37 if [ $? -eq 0 ] ; then
38 PROPVAL=`svcprop -p $1 ${SMF_FMRI}`
39 if [ "${PROPVAL}" = "\"\"" ] ; then
40 PROPVAL=""
42 return
44 return
47 getprop httpd/config_dir
48 if [ "${PROPVAL}" != "" ] ; then
49 NGINX_ETC_ROOT=$PROPVAL
52 NGINX_HOME=${NGINX_USR_ROOT}
53 NGINX_BIN=${NGINX_HOME}/sbin
55 getprop httpd/startup_options
56 if [ "${PROPVAL}" != "" ] ; then
57 echo startupoptions set
58 echo val=${PROPVAL}
59 STARTUP_OPTIONS="${PROPVAL} -k"
62 # Export NGINX_ETC_ROOT as an environment variable for use in config files
63 export NGINX_ETC_ROOT="${NGINX_ETC_ROOT}"
65 case "$1" in
66 start)
67 ${NGINX_BIN}/nginx ${STARTUP_OPTIONS} -c ${NGINX_ETC_ROOT}/nginx.conf 2>&1
70 echo "Usage: $0 {start}"
71 exit $SMF_EXIT_ERR_CONFIG
73 esac
76 if [ $? -ne 0 ]; then
77 echo "Server failed to start. Check the error log (defaults to ${NGINX_USR_ROOT}/var/nginx/logs/error_log) for more information, if any."
78 exit $SMF_EXIT_ERR_FATAL
81 exit $SMF_EXIT_OK