X-Original-To: alpine-aports@mail.alpinelinux.org Delivered-To: alpine-aports@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id DC3A8DC037A for ; Mon, 30 Nov 2015 09:05:05 +0000 (UTC) Received: from newmail.tetrasec.net (unknown [74.117.189.116]) by mail.alpinelinux.org (Postfix) with ESMTP id BD273DC00C5 for ; Mon, 30 Nov 2015 09:05:05 +0000 (UTC) Received: from ncopa-desktop.alpinelinux.org (unknown [79.160.13.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: n@tanael.org) by newmail.tetrasec.net (Postfix) with ESMTPSA id 66CF65A1552; Mon, 30 Nov 2015 08:54:24 +0000 (GMT) Date: Mon, 30 Nov 2015 10:04:59 +0100 From: Natanael Copa To: Valery Kartel , Kaarle Ritvanen Cc: alpine-aports@lists.alpinelinux.org Subject: Re: [alpine-aports] [PATCH] main/apache2: startup script cleanups Message-ID: <20151130100459.7b5375e5@ncopa-desktop.alpinelinux.org> In-Reply-To: <1446734319-9711-1-git-send-email-valery.kartel@gmail.com> References: <1446734319-9711-1-git-send-email-valery.kartel@gmail.com> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; x86_64-alpine-linux-musl) X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Kaarle, Could you please have a look at this? On Thu, 5 Nov 2015 16:38:39 +0200 Valery Kartel wrote: > --- > main/apache2/APKBUILD | 2 +- > main/apache2/apache2.confd | 8 --- > main/apache2/apache2.initd | 168 ++++++++------------------------------------- > main/apache2/ssl.conf | 2 +- > 4 files changed, 30 insertions(+), 150 deletions(-) > > diff --git a/main/apache2/APKBUILD b/main/apache2/APKBUILD > index 2eb2010..5fadee2 100644 > --- a/main/apache2/APKBUILD > +++ b/main/apache2/APKBUILD > @@ -3,7 +3,7 @@ > pkgname=apache2 > _pkgreal=httpd > pkgver=2.4.17 > -pkgrel=0 > +pkgrel=1 > pkgdesc="A high performance Unix-based HTTP server" > url="http://httpd.apache.org/" > arch="all" > diff --git a/main/apache2/apache2.confd b/main/apache2/apache2.confd > index aeb3222..58334da 100644 > --- a/main/apache2/apache2.confd > +++ b/main/apache2/apache2.confd > @@ -39,14 +39,6 @@ HTTPD_OPTS= > # They are normally dumped to your terminal. > #STARTUPERRORLOG="/var/log/apache2/startuperror.log" > > -# A command that outputs a formatted text version of the HTML at the URL > -# of the command line. Designed for lynx, however other programs may work. > -#LYNX="lynx -dump" > - > -# The URL to your server's mod_status status page. > -# Required for status and fullstatus > -#STATUSURL="http://localhost/server-status" > - > # Method to use when reloading the server > # Valid options are 'restart' and 'graceful' > # See http://httpd.apache.org/docs/2.2/stopping.html for information on > diff --git a/main/apache2/apache2.initd b/main/apache2/apache2.initd > index 2975e7a..29f4730 100755 > --- a/main/apache2/apache2.initd > +++ b/main/apache2/apache2.initd > @@ -1,154 +1,42 @@ > #!/sbin/openrc-run > > -extra_commands="configdump configtest modules virtualhosts" > -extra_started_commands="fullstatus graceful gracefulstop reload" > +pidfile=${PIDFILE:-/run/apache2/httpd.pid} > +configfile=${CONFIGFILE:-/etc/apache2/httpd.conf} > +serverroot=${SERVERROOT:-/var/www} > +command=${HTTPD:-/usr/sbin/httpd} > +command_args="-d $serverroot -f $configfile $HTTPD_OPTS" > +extra_started_commands="reload" > +required_files=$configfile > +required_dirs="$serverroot/modules $serverroot/logs" > +retry=${TIMEOUT:-10} > > depend() { > need net > - use mysql dns logger netmount postgresql > - after sshd firewall > + use dns logger netmount > } > > -configtest() { > - ebegin "Checking ${SVCNAME} configuration" > - checkconfig > - eend $? > -} > - > -checkconfd() { > - PIDFILE="${PIDFILE:-/run/apache2/httpd.pid}" > - TIMEOUT=${TIMEOUT:-10} > - > - SERVERROOT="${SERVERROOT:-/var/www}" > - if [ ! -d ${SERVERROOT} ]; then > - eerror "SERVERROOT does not exist: ${SERVERROOT}" > - return 1 > - fi > - > - CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}" > - [ "${CONFIGFILE#/}" = "${CONFIGFILE}" ] && CONFIGFILE="${SERVERROOT}/${CONFIGFILE}" > - if [ ! -r "${CONFIGFILE}" ]; then > - eerror "Unable to read configuration file: ${CONFIGFILE}" > - return 1 > - fi > - > - HTTPD_OPTS="${HTTPD_OPTS} -d ${SERVERROOT}" > - HTTPD_OPTS="${HTTPD_OPTS} -f ${CONFIGFILE}" > - [ -n "${STARTUPERRORLOG}" ] && HTTPD_OPTS="${HTTPD_OPTS} -E ${STARTUPERRORLOG}" > - return 0 > - > -} > - > -checkconfig() { > - checkconfd || return 1 > - > - ${HTTPD} ${HTTPD_OPTS} -t 1>/dev/null 2>&1 > +start_pre() { > + ebegin > + [ -n "$STARTUPERRORLOG" ] && command_args="-E $STARTUPERRORLOG $command_args" > + $command $command_args -t 2>/dev/null > ret=$? > - if [ $ret -ne 0 ]; then > - eerror "${SVCNAME} has detected an error in your setup:" > - ${HTTPD} ${HTTPD_OPTS} -t > - fi > - > - return $ret > -} > - > -start() { > - checkconfig || return 1 > - checkpath --directory $(dirname $PIDFILE) > - > - [ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache > - > - ebegin "Starting ${SVCNAME}" > - start-stop-daemon --start \ > - --pidfile ${PIDFILE} \ > - --exec ${HTTPD} \ > - -- ${HTTPD_OPTS} -k start > - eend $? > -} > - > -stop() { > - checkconfd || return 1 > - > - ebegin "Stopping ${SVCNAME}" > - start-stop-daemon --stop --pidfile ${PIDFILE} --exec ${HTTPD} \ > - --retry ${TIMEOUT} > - eend $? > -} > - > -reload() { > - RELOAD_TYPE="${RELOAD_TYPE:-graceful}" > - > - checkconfig || return 1 > - service_started "${SVCNAME}" || return > - > - if [ "${RELOAD_TYPE}" = "restart" ]; then > - ebegin "Restarting ${SVCNAME}" > - ${HTTPD} ${HTTPD_OPTS} -k restart > - eend $? > - elif [ "${RELOAD_TYPE}" = "graceful" ]; then > - ebegin "Gracefully restarting ${SVCNAME}" > - ${HTTPD} ${HTTPD_OPTS} -k graceful > - eend $? > + if [ $ret -eq 0 ]; then > + user=$($command $command_args -t -D DUMP_RUN_CFG | grep ^User: | cut -d\" -f2) > + group=$($command $command_args -t -D DUMP_RUN_CFG | grep ^Group: | cut -d\" -f2) > + checkpath --directory --owner $user:$group --mode 0750 ${pidfile%/*} > + [ -L $serverroot/run ] && rm $serverroot/run > + ln -s ${pidfile%/*} $serverroot/run > + [ -f $serverroot/run/scache ] && rm $serverroot/run/scache > else > - eerror "${RELOAD_TYPE} is not a valid RELOAD_TYPE. Please edit /etc/conf.d/${SVCNAME}" > + [ -z "$STARTUPERRORLOG" ] && $command $command_args -t > fi > + eend $ret > } > > -graceful() { > - checkconfig || return 1 > - service_started "${SVCNAME}" || return > - ebegin "Gracefully restarting ${SVCNAME}" > - ${HTTPD} ${HTTPD_OPTS} -k graceful > - eend $? > -} > - > -gracefulstop() { > - checkconfig || return 1 > - ebegin "Gracefully stopping ${SVCNAME}" > - start-stop-daemon --stop --pidfile ${PIDFILE} --exec ${HTTPD} \ > - --retry SIGWINCH/${TIMEOUT} > +reload() { > + ebegin "Reloading ${SVCNAME}" > + signal=HUP > + [ $RELOAD_TYPE = "graceful" ] && signal=USR1 > + start-stop-daemon --signal $signal --pidfile $pidfile --name $SVCNAME > eend $? > } > - > -modules() { > - checkconfig || return 1 > - > - ${HTTPD} ${HTTPD_OPTS} -M 2>&1 > -} > - > -fullstatus() { > - LYNX="${LYNX:-lynx -dump}" > - STATUSURL="${STATUSURL:-http://localhost/server-status}" > - > - if ! service_started "${SVCNAME}"; then > - eerror "${SVCNAME} not started" > - elif ! type -p $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then > - eerror "lynx not installed!" > - else > - ${LYNX} ${STATUSURL} > - fi > -} > - > -virtualhosts() { > - checkconfd || return 1 > - ${HTTPD} ${HTTPD_OPTS} -S > -} > - > -configdump() { > - LYNX="${LYNX:-lynx -dump}" > - INFOURL="${INFOURL:-http://localhost/server-info}" > - > - checkconfd || return 1 > - > - if ! service_started "${SVCNAME}"; then > - eerror "${SVCNAME} not started" > - elif ! type -p $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then > - eerror "lynx not installed!" > - else > - echo "${HTTPD} started with '${HTTPD_OPTS}'" > - for i in config server list; do > - ${LYNX} "${INFOURL}/?${i}" | sed '/Apache Server Information/d;/^[[:space:]]\+[_]\+$/Q' > - done > - fi > -} > - > diff --git a/main/apache2/ssl.conf b/main/apache2/ssl.conf > index e201954..78358b5 100644 > --- a/main/apache2/ssl.conf > +++ b/main/apache2/ssl.conf > @@ -34,7 +34,7 @@ SSLPassPhraseDialog builtin > # Configure the SSL Session Cache: First the mechanism > # to use and second the expiring timeout (in seconds). > #SSLSessionCache dc:UNIX:/var/cache/mod_ssl/distcache > -SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000) > +SSLSessionCache shmcb:run/scache(512000) > SSLSessionCacheTimeout 300 > > # Pseudo Random Number Generator (PRNG): --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---