Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add systemd service script and fix other init scripts

Other changes:
 * Replace README by README.md
 * Add travis configuration
 * Fix testsuite and dependencies detection
  • Loading branch information...
commit 5b362c488dd2214696b237cfcbd1fa416f97150a 1 parent 5f04abe
@capflam capflam authored
View
43 .travis.yml
@@ -0,0 +1,43 @@
+language: erlang
+otp_release:
+ - 17.0
+ - R16B03-1
+ - R16B03
+ - R16B02
+ - R16B01
+ - R15B03
+ - R15B02
+ - R15B01
+ - R14B04
+ - R14B03
+ - R14B02
+
+before_install:
+ - sudo apt-get update -qq
+ - sudo apt-get install -y autotools-dev libpam0g-dev texlive-latex-base texlive-latex-recommended texlive-fonts-recommended texlive-font-utils texlive-extra-utils ghostscript
+
+install:
+ - autoreconf -vfi
+
+before_script:
+ - ./configure
+
+script:
+ - make distcheck -j4 V=1
+
+after_script:
+ - rebar get-deps compile
+
+notifications:
+ email:
+ recipients:
+ - christopher.faulet@capflam.org
+ - vinoski@ieee.org
+ - klacke@hyber.org
+ on_success: change
+ on_failure: always
+
+
+
+
+
View
2  Makefile.am
@@ -20,7 +20,7 @@ SUBDIRS += examples/src examples/ebin examples/include \
test doc man scripts www/code www/shoppingcart
EXTRA_DIST = ChangeLog known_dialyzer_warnings LICENSE \
- README README.osx README.pkg-config \
+ README.md README.osx README.pkg-config \
rebar.config rebar.config.script two-mode-mode.el vsn.mk \
include.mk erlang_deps.mk ssl munin contrib www rel
View
131 README
@@ -1,131 +0,0 @@
-This is Yaws, a webserver for dynamic content written in Erlang.
-
-
-To build and install
-
-
-1. Prepare build
-
- Get and install an Erlang system (http://www.erlang.org)
-
- If you've cloned the source from github and you want to build using autotools,
- note there is no ./configure script in the source, so create one:
-
- $> autoconf
-
- Install build-deps. On Ubuntu/debian this is pretty much equal to
-
- $> apt-get build-dep yaws
-
-2. Build
-
- You can build using rebar:
-
- $> rebar get-deps compile
-
- or via autotools:
-
- $> ./configure --prefix=/usr/local
-
- If using rebar, you'll get a "local installation" with Yaws script in ./bin
- and the Yaws configuration file in ./etc/yaws.
-
- If using autotools, the build will be configured by default for installation
- under /usr/local. For more information about installation directories and
- other supported options, see the configure help. Useful options are:
-
- --with-defaultcharset=CHARSET specify default charset, i.e UTF-8
- --with-extrainclude=DIR dir to include if e.g. pam is installed in some odd place
- --with-erlang=PREFIX prefix where Erlang is installed (optional)
-
-
- Note to packagers (rpm, deb ...) All install targets support the DESTDIR
- variable. Thus, if we do
-
- $> ./configure --prefix=/usr; make
-
- we can subsequently do:
-
- $> make install DESTDIR=/foo/bar
-
- All Yaws files will be installed under DESTDIR, but all code will assume Yaws
- should be installed under /usr.
-
- Main make targets:
-
- * all : compile Yaws
- * debug : compile Yaws with debug flags
- * clean : remove files produced by all or debug target
- * install : do a proper install of Yaws
- * doc or docs : build the documentation
- * check or test : launch tests
- * cleantest : remove files produced by check target
- * dialyzer : run dialyzer on Yaws
- * mkinstaller : build an installer for windows
- * cleaninstaller: remove files produced by mkinstaller target
- * apps : compile Yaws applications (chat,mail,wiki,yapp)
- * cleanapps : remove files produced by apps target
- * installapps : install Yaws applications
- * fullinstall : install + installapps
- * fullclean : clean + cleantest + cleanapps + cleaninstaller
-
-3. Test your build
-
- With autotools, to test the build, you should install it somewhere:
-
- $> ./configure --prefix=$PWD/_inst && make install
- $> $PWD/_inst/bin/yaws -i
-
- If you used rebar to compile Yaws, you can alternatively start Yaws with
-
- $> ./bin/yaws -i
-
- Either approach will start a webserver at http://0.0.0.0:8000
- Terminate through ^C, or ^G followed by q, or
-
- > init:stop()
-
- NOTE: If you've used rebar to build the system, none of the following
- directions apply. With rebar only "local installations" are supported.
-
-4. Install and run
-
- NOTE: following commands may require root privileges, depending of the
- installation prefix.
-
- just run
-
- $> make install
-
- Then, to run Yaws, you should use its script:
-
- $> ${bindir}/yaws -i
-
- This starts an interactive system.
-
- With the default yaws.conf file, this will create a webserver at
- http://${host} and one at https://${host}
-
-
- You can adapt Yaws configuration by editing '${sysconfig}/yaws/yaws.conf'.
-
-5. Daemonize Yaws
-
- Start it using '--daemon' and '--heart' options
-
- $> ${bindir}/yaws --daemon --heart
-
- This will start a daemon (--daemon) which will be autorestarted when/if it
- crashes or hangs (--heart).
- Also, for most unices, we create proper start scripts in ${sysconfdir}/init.d
-
- Example: Here is how I compile/start the yaws system that runs at
- http://yaws.hyber.org (Ubuntu server system)
-
- $> autoconf
- $> ./configure --sysconfdir=/etc
- $> make && make install
- $> /etc/init.d/yaws start
-
-
-
View
162 README.md
@@ -0,0 +1,162 @@
+This is Yaws, a webserver for dynamic content written in Erlang.
+
+Prepare build
+-------------
+
+Get and install an Erlang system (http://www.erlang.org)
+
+If you've cloned the source from github and you want to build using autotools,
+note there is no ./configure script in the source, so create one:
+
+ $> autoreconf -fi
+
+Install build dependencies. Required packages to compile Yaws are (based on
+debian packages):
+
+* build-essential
+* autoconf/automake/libtool
+* erlang - Required apps:
+ * erlang-{kernel/stdlib/sasl/erts}
+ * erlang-compiler
+ * erlang-crypto
+ * erlang-xmerl
+
+To build the documentation (optional), you also need to install:
+
+* texlive-latex-base
+* texlive-latex-recommended
+* texlive-fonts-recommended
+* texlive-font-utils
+* texlive-extra-utils
+* ghostscript
+
+On Ubuntu/debian this is pretty much equal to:
+
+ $> apt-get build-dep yaws
+
+Finally, to run the testsuites, yaws need to install:
+
+* git
+* wget
+* curl
+* erlang-eunit
+* erlang-inets
+* erlang-mnesia
+* erlang-ssl
+* cadaver
+
+
+Build
+-----
+
+You can build using rebar:
+
+ $> rebar get-deps compile
+
+or via autotools:
+
+ $> ./configure --prefix=/usr/local
+
+If using rebar, you'll get a "local installation" with Yaws script in ./bin
+and the Yaws configuration file in ./etc/yaws.
+
+If using autotools, the build will be configured by default for installation
+under /usr/local. For more information about installation directories and
+other supported options, see the configure help. Useful options are:
+
+ --with-defaultcharset=CHARSET specify default charset, i.e UTF-8
+ --with-extrainclude=DIR dir to include if e.g. pam is installed in some odd place
+ --with-erlang=PREFIX prefix where Erlang is installed (optional)
+
+Note to packagers (rpm, deb ...) All install targets support the DESTDIR
+variable. Thus, if we do
+
+ $> ./configure --prefix=/usr; make
+
+we can subsequently do:
+
+ $> make install DESTDIR=/foo/bar
+
+All Yaws files will be installed under DESTDIR, but all code will assume Yaws
+should be installed under /usr.
+
+Main make targets:
+
+* all : compile Yaws
+* debug : compile Yaws with debug flags
+* clean : remove files produced by all or debug target
+* install : do a proper install of Yaws
+* doc or docs : build the documentation
+* check or test : launch tests
+* cleantest : remove files produced by check target
+* dialyzer : run dialyzer on Yaws
+* mkinstaller : build an installer for windows
+* cleaninstaller: remove files produced by mkinstaller target
+* apps : compile Yaws applications (chat,mail,wiki,yapp)
+* cleanapps : remove files produced by apps target
+* installapps : install Yaws applications
+* fullinstall : install + installapps
+* fullclean : clean + cleantest + cleanapps + cleaninstaller
+
+
+Test your build
+---------------
+
+With autotools, to test the build, you should install it somewhere:
+
+ $> ./configure --prefix=$PWD/_inst && make install
+ $> $PWD/_inst/bin/yaws -i
+
+If you used rebar to compile Yaws, you can alternatively start Yaws with
+
+ $> ./bin/yaws -i
+
+Either approach will start a webserver at http://0.0.0.0:8000
+Terminate through ^C, or ^G followed by q, or
+
+ > init:stop()
+
+NOTE: If you've used rebar to build the system, none of the following
+directions apply. With rebar only "local installations" are supported.
+
+
+Install and run
+---------------
+
+NOTE: following commands may require root privileges, depending of the
+installation prefix.
+
+Just run:
+
+ $> make install
+
+Then, to run Yaws, you should use its script:
+
+ $> ${bindir}/yaws -i
+
+This starts an interactive system.
+
+With the default yaws.conf file, this will create a webserver at
+http://${host} and one at https://${host}.
+
+You can adapt Yaws configuration by editing '${sysconfig}/yaws/yaws.conf'.
+
+
+Daemonize Yaws
+--------------
+
+Start it using '--daemon' and '--heart' options:
+
+ $> ${bindir}/yaws --daemon --heart
+
+This will start a daemon (--daemon) which will be autorestarted when/if it
+crashes or hangs (--heart).
+Also, for most unices, we create proper start scripts in ${sysconfdir}/init.d
+
+Example: Here is how I compile/start the yaws system that runs at
+http://yaws.hyber.org (Ubuntu server system)
+
+ $> autoreconf -fi
+ $> ./configure --sysconfdir=/etc
+ $> make && make install
+ $> /etc/init.d/yaws start
View
17 configure.ac
@@ -247,17 +247,19 @@ AC_ERLANG_CHECK_LIB([crypto],, [AC_MSG_ERROR(["crypto" Erlang application not
AC_ERLANG_CHECK_LIB([xmerl],, [AC_MSG_ERROR(["xmerl" Erlang application not found.])])
AC_ERLANG_CHECK_LIB([public_key],,[AC_MSG_WARN(["public_key" Erlang application not found.
-It clould be required to run Yaws.])])
+It could be required to run Yaws or its testsuites.])])
AC_ERLANG_CHECK_LIB([ssl],, [AC_MSG_WARN(["ssl" Erlang application not found.
-It clould be required to run Yaws.])])
+It could be required to run Yaws or its testsuites.])])
AC_ERLANG_CHECK_LIB([mnesia],, [AC_MSG_WARN(["mnesia" Erlang application not found.
-It clould be required to run Yaws.])])
+It could be required to run Yaws or its testsuites.])])
AC_ERLANG_CHECK_LIB([eunit],, [AC_MSG_WARN(["eunit" Erlang application not found.
-It clould be required to run Yaws.])])
+It could be required to run Yaws or its testsuites.])])
AC_ERLANG_CHECK_LIB([erlsom],, [AC_MSG_WARN(["erlsom" Erlang application not found.
-It clould be required to run Yaws.])])
+It could be required to run Yaws or its testsuites.])])
AC_ERLANG_CHECK_LIB([xmlrpc],, [AC_MSG_WARN(["xmlrpc" Erlang application not found.
-It clould be required to run Yaws.])])
+It could be required to run Yaws or its testsuites.])])
+AC_ERLANG_CHECK_LIB([inets],, [AC_MSG_WARN(["xmlrpc" Erlang application not found.
+It could be required to run Yaws or its testsuites.])])
cross_compiling=$tmp_cross_compiling
@@ -400,6 +402,9 @@ AM_CONDITIONAL(CAN_BUILD_DOC,
AC_ARG_VAR([CADAVER], [command-line WebDAV client for Unix])
AC_CHECK_PROG([CADAVER], [cadaver], [cadaver])
+AC_ARG_VAR([CURL], [command-line tool for transferring data with URL syntax])
+AC_CHECK_PROG([CURL], [curl], [curl])
+
AC_ARG_VAR([UNIX2DOS], [converts DOS <-> Unix text files])
AC_CHECK_PROG([UNIX2DOS], [unix2dos], [unix2dos])
View
2  doc/yaws.tex
@@ -2236,7 +2236,7 @@ \section{Global Part}
To stop the Yaws server with id "foobar". Each \Yaws\ server will
write its internals data into a file called \$HOME/.yaws/yaws/ID
where ID is the identity of the server. Yaws also creates a file
- called \${VARDIR}/run/yaws/ctl-\${ID} which contain the port
+ called \$HOME/.yaws/yaws/ID/CTL which contain the port
number where the server is listening for control commands. The
default id is "default".
View
6 known_dialyzer_warnings
@@ -1,6 +1,6 @@
-yaws.erl:2553: Guard test Ret::'file' == 'fd' can never succeed
-yaws.erl:2561: Guard test Ret::'file' == 'binfd' can never succeed
+yaws.erl:2573: Guard test Ret::'file' == 'fd' can never succeed
+yaws.erl:2581: Guard test Ret::'file' == 'binfd' can never succeed
yaws_api.erl:2592: The pattern 'false' can never match the type 'true'
yaws_config.erl:595: The pattern 'false' can never match the type 'true'
yaws_ctl.erl:532: Function hup/1 has no local return
@@ -11,7 +11,7 @@ yaws_ctl.erl:566: Function trace/1 has no local return
yaws_ctl.erl:569: Function debug_dump/1 has no local return
yaws_ctl.erl:572: Function stats/1 has no local return
yaws_ctl.erl:574: Function running_config/1 has no local return
-yaws_revproxy.erl:678: The pattern 'true' can never match the type 'false'
+yaws_revproxy.erl:677: The pattern 'true' can never match the type 'false'
yaws_sendfile.erl:51: The pattern 'false' can never match the type 'true'
yaws_sendfile.erl:62: The pattern 'false' can never match the type 'true'
yaws_sup_restarts.erl:49: The pattern 'false' can never match the type 'true'
View
2  man/yaws.1
@@ -132,7 +132,7 @@ server will write all internal files into the directory
$HOME/.yaws/yaws/ID.
Yaws also creates a file called
-${VARDIR}/run/yaws/ctl-${ID} which contains the portnumber the daemon
+$HOME/.yaws/yaws/ID/CTL which contains the portnumber the daemon
is listening on for control request by the control command such
as "yaws --hup" etc.
View
2  man/yaws.conf.5
@@ -71,7 +71,7 @@ Yaws server to control it using the different control commands such as:
To stop the Yaws server with id "foobar". Each Yaws server will write its
internals data into a file called $HOME/.yaws/yaws/ID where ID is the identity
-of the server. Yaws also creates a file called ${VARDIR}/run/yaws/ctl-${ID}
+of the server. Yaws also creates a file called $HOME/.yaws/yaws/ID/CTL
which contain the port number where the server is listening for control
commands. The default id is \fI"default"\fR.
View
2  scripts/Makefile.am
@@ -20,6 +20,7 @@ uninstall-local:
$(AM_V_at)rm -f $(DESTDIR)$(bindir)/yaws
$(AM_V_at)rm -f $(DESTDIR)$(sysconfdir)/init.d/yaws
$(AM_V_at)rm -f $(DESTDIR)$(sysconfdir)/rc.d/yaws
+ $(AM_V_at)rm -f $(DESTDIR)$(sysconfdir)/systemd/system/yaws.service
$(AM_V_at)rm -f $(DESTDIR)$(confdir)/yaws.conf.template
yaws_script:
@@ -68,6 +69,7 @@ yaws_init_script:
DESTDIR='$(DESTDIR)' \
PREFIX='$(prefix)' \
ETCDIR='$(sysconfdir)' \
+ BINDIR='$(bindir)' \
VARDIR='$(localstatedir)' \
YAWSDIR='$(ERLANG_INSTALL_LIB_DIR_yaws)' \
./regular-install)
View
21 scripts/darwin/Yaws.StartupItem
@@ -6,17 +6,19 @@
. /etc/rc.common
-yaws=%prefix%/bin/yaws
+yaws=%bindir%/yaws
lockdir=/var/spool/lock
-yawsid_opts='--id myserverid'
+#yawsid_opts='--id myserverid'
+conf="--conf %etcdir%/yaws/yaws.conf"
StartService ()
{
if [ "${YAWS:=-NO-}" = "-YES-" ]; then
- ConsoleMessage "Starting yaws http daemon"
- HOME=/tmp $yaws ${yawsid_opts} --daemon --heart
- RETVAL=$?
- [ $RETVAL = 0 ]
+ ConsoleMessage "Starting yaws http daemon"
+ HOME=/tmp $yaws ${yawsid_opts} --daemon --heart ${conf}
+ HOME=/tmp $yaws ${yawsid_opts} --wait-started=10 >/dev/null
+ RETVAL=$?
+ [ $RETVAL = 0 ]
fi
}
@@ -24,15 +26,16 @@ StopService ()
{
ConsoleMessage "Stopping yaws http daemon"
HOME=/tmp $yaws ${yawsid_opts} --stop
+ HOME=/tmp $yaws ${yawsid_opts} --wait-stopped=10 >/dev/null
}
RestartService ()
{
if [ "${YAWS:=-NO-}" = "-YES-" ]; then
- ConsoleMessage "Restarting yaws http daemon"
- HOME=/tmp $yaws ${yawsid_opts} --hup
+ ConsoleMessage "Restarting yaws http daemon"
+ HOME=/tmp $yaws ${yawsid_opts} --hup
else
- StopService
+ StopService
fi
}
View
72 scripts/debian/yaws.init
@@ -0,0 +1,72 @@
+#! /bin/sh
+
+### BEGIN INIT INFO
+# Provides: yaws
+# Required-Start: $remote_fs $network
+# Required-Stop: $remote_fs $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Starts Yaws web server
+# Description: Starts Yaws web server, a high perfomance
+# HTTP 1.1 webserver written in Erlang.
+### END INIT INFO
+
+DAEMON=%bindir%/yaws
+NAME=yaws
+DESC="Yaws web server"
+DAEMON_OPTS="--daemon --heart --conf %etcdir%/yaws/yaws.conf"
+
+## By default we run with the default id
+# YAWS_ID_OPTS=--id myserverid
+
+test -x $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
+start()
+{
+ start-stop-daemon --quiet --exec $DAEMON --start -- \
+ $DAEMON_OPTS $YAWS_ID_OPTS
+ $DAEMON $YAWS_ID_OPTS --wait-started=10 >/dev/null
+}
+
+stop()
+{
+ $DAEMON $YAWS_ID_OPTS --stop > /dev/null
+ $DAEMON $YAWS_ID_OPTS --wait-stopped=10 >/dev/null
+}
+
+case "$1" in
+ start)
+ log_daemon_msg "Starting $DESC" "$NAME"
+ start
+ log_end_msg $?
+ ;;
+ stop)
+ log_daemon_msg "Stopping $DESC" "$NAME"
+ stop
+ log_end_msg $?
+ ;;
+ status)
+ $DAEMON $YAWS_ID_OPTS --status > /dev/null && \
+ log_success_msg "Yaws is running" || \
+ log_failure_msg "Yaws is not running"
+ ;;
+ reload|force-reload)
+ log_daemon_msg "Reloading $DESC config" "$NAME"
+ $DAEMON $YAWS_ID_OPTS --hup >/dev/null && log_end_msg 0 || log_end_msg 1
+ ;;
+ restart)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ stop
+ start
+ log_end_msg $?
+ ;;
+ *)
+ N=%etcdir%/init.d/$NAME
+ echo "Usage: $N {start|stop|status|restart|reload|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
View
57 scripts/debian/yaws.init.d
@@ -1,57 +0,0 @@
-#!/bin/bash
-#
-# Startup script for the Yaws Web Server
-#
-# config: /etc/yaws.conf
-#
-
-
-
-
-yaws=%prefix%/bin/yaws
-prog=yaws
-
-# By default we run with the default id, "default"
-# idopts=--id myserverid
-
-conf="--conf %etcdir%/yaws/yaws.conf"
-heart="-heart"
-
-test -x $yaws || exit 1
-
-
-case "$1" in
- start)
- echo -n "Starting $prog: "
- $yaws ${idopts} --daemon ${heart} ${conf}
- echo "."
- ;;
- stop)
- echo -n "Stopping $prog: "
- $yaws ${idopts} --stop
- echo "."
- ;;
- reload)
- echo -n "Reloading $prog: "
- $yaws ${idopts} --hup
- echo "."
- ;;
- status)
- $yaws ${idopts} --status
- echo "."
- ;;
- restart)
- echo -n "Stopping $prog: "
- $yaws ${idopts} --stop
- echo -n "Starting $prog: "
- $yaws ${idopts} --daemon ${heart} ${conf}
- echo "."
- ;;
-
- *)
- echo $"Usage: $prog {start|stop|restart|reload|status}"
- exit 1
-esac
-
-exit 0
-
View
63 scripts/freebsd/yaws
@@ -3,32 +3,73 @@
# Start up for the Yaws daemon. Use this script for FreeBSD versions 9 or greater.
#
-# PROVIDE: yaws
-# BEFORE: DAEMON
+# REQUIRE: DAEMON
+# PROVIDE: yaws
# KEYWORD: shutdown
. /etc/rc.subr
-name="yaws"
+name=yaws
+rcvar=yaws_enable
+
+command="%bindir%/yaws"
+
yaws_id="default" # By default we run with the default id
-start_precmd="${name}_prestart"
+start_cmd="yaws_start"
stop_cmd="yaws_stop"
status_cmd="yaws_status"
-command="%prefix%/bin/${name}"
-rcvar="yaws_enable"
+reload_cmd="yaws_reload"
command_args=""
-required_files="%etcdir%/${name}/${name}.conf"
+extra_commands="reload"
+required_files="%etcdir%/yaws/yaws.conf"
-yaws_prestart() {
- rc_flags="--id ${yaws_id} --daemon --heart --conf %etcdir%/${name}/${name}.conf ${rc_flags}"
+yaws_start() {
+ echo -n "Starting Yaws: "
+ ${command} --id ${yaws_id} --daemon --heart --conf %etcdir%/yaws/yaws.conf ${rc_flags}
+ ${command} --id ${yaws_id} --wait-started=10 > /dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "OK"
+ else
+ echo "FAILED"
+ fi
+ return $RETVAL
}
yaws_stop() {
- %prefix%/bin/yaws --id ${yaws_id} --stop
+ echo -n "Stopping Yaws: "
+ ${command} --id ${yaws_id} --stop > /dev/null
+ ${command} --id ${yaws_id} --wait-stopped=10 > /dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "OK"
+ else
+ echo "FAILED"
+ fi
+ return $RETVAL
}
yaws_status() {
- %prefix%/bin/yaws --id ${yaws_id} --status
+ ${command} --id ${yaws_id} --status > /dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "Yaws is running"
+ else
+ echo "Yaws is stopped"
+ fi
+ return $RETVAL
+}
+
+yaws_reload() {
+ echo -n "Reloading Yaws: "
+ ${command} --id ${yaws_id} --hup > /dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "OK"
+ else
+ echo "FAILED"
+ fi
+ return $RETVAL
}
load_rc_config $name
View
41 scripts/freebsd/yaws.sh
@@ -16,19 +16,52 @@ else
fi
start() {
- $yaws ${idarg} --daemon --heart --conf ${conf}
+ echo -n "Starting Yaws: "
+ $yaws ${idarg} --daemon --heart --conf ${conf} > /dev/null
+ $yaws ${idarg} --wait-started=10 > /dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "OK"
+ else
+ echo "FAILED"
+ fi
+ return $RETVAL
}
stop() {
- $yaws ${idarg} --stop
+ echo -n "Stopping Yaws: "
+ $yaws ${idarg} --stop > /dev/null
+ $yaws ${idarg} --wait-stopped=10 > /dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "OK"
+ else
+ echo "FAILED"
+ fi
+ return $RETVAL
}
reload() {
- $yaws ${idarg} --hup
+ echo -n "Reloading Yaws: "
+ $yaws ${idarg} --hup > /dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "OK"
+ else
+ echo "FAILED"
+ fi
+ return $RETVAL
}
status() {
- $yaws ${idarg} --status
+ $yaws ${idarg} --status > /dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "Yaws is running"
+ else
+ echo "Yaws is stopped"
+ fi
+ return $RETVAL
}
View
34 scripts/gentoo/yaws.ebuild
@@ -1,34 +0,0 @@
-# $Header: $
-
-EAPI="2"
-
-inherit eutils
-
-DESCRIPTION="Yaws is a high performance HTTP 1.1 web server."
-HOMEPAGE="http://yaws.hyber.org/"
-SRC_URI="http://yaws.hyber.org/download/${P}.tar.gz"
-LICENSE="BSD"
-SLOT="0"
-KEYWORDS="~x86 ~ppc ~sparc ~amd64"
-IUSE=""
-
-DEPEND="dev-lang/erlang"
-
-PROVIDE="virtual/httpd-basic virtual/httpd-cgi"
-
-src_install() {
- make DESTDIR=${D} install || edie
- keepdir /var/log/yaws
- rmdir ${D}var/lib/log/yaws
- rmdir ${D}var/lib/log
- # We need to keep these directories so that the example yaws.conf works
- # properly
- keepdir /usr/lib/yaws/examples/ebin
- keepdir /usr/lib/yaws/examples/include
- dodoc ChangeLog LICENSE README
-}
-
-pkg_postinst() {
- einfo "An example YAWS configuration has been setup to run on"
- einfo "Please edit /etc/yaws/yaws.conf to suit your needs."
-}
View
12 scripts/gentoo/init.d.yaws → scripts/gentoo/yaws.init
@@ -9,14 +9,14 @@
# use: rc-update add yaws default
#
-yaws=%prefix%/bin/yaws
+yaws=%bindir%/yaws
# By default we run with the default id
# idopts="--id myserverid"
conf="--conf %etcdir%/yaws/yaws.conf"
-opts="start stop reload restart query"
+opts="start stop reload restart query"
depend() {
need net
@@ -26,26 +26,28 @@ depend() {
start() {
ebegin "Starting yaws "
${yaws} --daemon --heart ${idopts} ${conf}
+ ${yaws} ${idopts} --wait-started=10
eend $?
}
stop() {
ebegin "Stopping yaws "
- ${yaws} --stop ${idopts}
+ ${yaws} ${idopts} --stop
+ ${yaws} ${idopts} --wait-stopped=10
eend $?
}
reload() {
ebegin "Reloading yaws "
- ${yaws} --hup ${idopts}
+ ${yaws} ${idopts} --hup
eend $?
}
query() {
ebegin "Querying yaws "
- ${yaws} --status ${idopts}
+ ${yaws} ${idopts} --status
eend $?
}
View
57 scripts/netbsd/yaws.sh
@@ -12,14 +12,13 @@
# yaws_id=""
#
-if [ -f /etc/rc.subr ]
-then
- . /etc/rc.subr
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
fi
name="yaws"
rcvar=$name
-yaws_command="%prefix%/bin/${name}"
+yaws_command="%bindir%/${name}"
required_files="%etcdir%/yaws/yaws.conf"
start_cmd="yaws_start"
@@ -35,25 +34,57 @@ fi
: ${yaws_flags:=--heart}
yaws_start() {
- $yaws_command $yaws_id $yaws_flags --daemon
+ echo -n "Starting Yaws: "
+ $yaws_command $yaws_id $yaws_flags --daemon --conf %etcdir%/yaws/yaws.conf >/dev/null
+ $yaws_command $yaws_id --wait-started=10 >/dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "OK"
+ else
+ echo "FAILED"
+ fi
+ return $RETVAL
}
yaws_stop() {
- $yaws_command $yaws_id --stop
+ echo -n "Stopping Yaws: "
+ $yaws_command $yaws_id --stop >/dev/null
+ $yaws_command $yaws_id --wait-stopped=10 >/dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "OK"
+ else
+ echo "FAILED"
+ fi
+ return $RETVAL
}
yaws_status() {
- $yaws_command $yaws_id --status
+ $yaws_command $yaws_id --status >/dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "Yaws is running"
+ else
+ echo "Yaws is stopped"
+ fi
+ return $RETVAL
}
yaws_reload() {
- $yaws_command $yaws_id --hup
+ echo -n "Reloading Yaws: "
+ $yaws_command $yaws_id --hup >/dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "OK"
+ else
+ echo "FAILED"
+ fi
+ return $RETVAL
}
-if [ -f /etc/rc.subr -a -f /etc/rc.conf ]
-then
- load_rc_config $name
- run_rc_command "$1"
+if [ -f /etc/rc.subr -a -f /etc/rc.conf ]; then
+ load_rc_config $name
+ run_rc_command "$1"
else
- yaws_start
+ yaws_start
fi
View
16 scripts/openbsd/yaws.sh
@@ -1,20 +1,18 @@
#!/bin/sh
-daemon="/usr/local/bin/yaws"
-daemon_flags="--daemon --conf /etc/yaws/yaws.conf"
+daemon="${TRUEPREFIX}/bin/yaws --daemon"
+daemon_flags="--conf ${SYSCONFDIR}/yaws/yaws.conf"
. /etc/rc.d/rc.subr
-pexp="/usr/local/lib/erlang/erts.*/usr/local/lib/yaws/ebin -run yaws"
+pexp="${LOCALBASE}/lib/erlang/erts.*${TRUEPREFIX}/lib/yaws/ebin -run yaws"
-rc_stop() {
- su -l -c ${daemon_class} -s ${daemon_shell} ${daemon_user} \
- -c "${daemon} --stop" >/dev/null
+rc_reload() {
+ ${rcexec} "${daemon} --hup"
}
-rc_reload() {
- su -l -c ${daemon_class} -s ${daemon_shell} ${daemon_user} \
- -c "${daemon} --hup" >/dev/null
+rc_stop() {
+ ${rcexec} "${daemon} --stop"
}
rc_cmd $1
View
103 scripts/redhat/yaws.init
@@ -0,0 +1,103 @@
+#!/bin/bash
+#
+# Startup script for the Yaws Web Server
+#
+# config: /etc/yaws.conf
+#
+# chkconfig: 2345 65 35
+# description: yaws - Erlang enabled http server
+# use "/sbin/chkconfig --add yaws" to install
+
+# Source function library.
+
+. /etc/rc.d/init.d/functions
+
+yaws=%bindir%/yaws
+prog=yaws
+heart=--heart
+
+#
+# Default yawsid is "default". If you change this to another ID,
+# be sure to also uncomment the yawsid_opts line just below.
+#
+yawsid=default
+#yawsid_opts="--id $yawsid"
+conf="--conf %etcdir%/yaws/yaws.conf"
+
+start() {
+ echo -n $"Starting $prog: "
+ $yaws ${yawsid_opts} --daemon ${heart} ${conf}
+ $yaws ${yawsid_opts} --wait-started=10 >/dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo_success
+ else
+ echo_failure
+ fi
+ echo
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping $prog: "
+ $yaws ${yawsid_opts} --stop >/dev/null
+ $yaws ${yawsid_opts} --wait-stopped=10 >/dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo_success
+ else
+ echo_failure
+ fi
+ echo
+ return $RETVAL
+}
+
+
+reload() {
+ echo -n $"Reloading $prog: "
+ $yaws ${yawsid_opts} --hup >/dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo_success
+ else
+ echo_failure
+ fi
+ echo
+ return $RETVAL
+}
+
+status() {
+ $yaws ${yawsid_opts} --status >/dev/null
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ echo "$prog is running..."
+ else
+ echo "$prog is stopped..."
+ fi
+ return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ reload)
+ reload
+ ;;
+ *)
+ echo $"Usage: $prog {start|stop|restart|reload|status}"
+ exit 1
+esac
+
+exit $RETVAL
View
91 scripts/redhat/yaws.init.d
@@ -1,91 +0,0 @@
-#!/bin/bash
-#
-# Startup script for the Yaws Web Server
-#
-# config: /etc/yaws.conf
-#
-# chkconfig: 2345 65 35
-# description: yaws - Erlang enabled http server
-# use "/sbin/chkconfig --add yaws" to install
-
-# Source function library.
-
-. /etc/rc.d/init.d/functions
-
-yaws=%prefix%/bin/yaws
-prog=yaws
-heart=--heart
-
-#
-# Default yawsid is "default". If you change this to another ID,
-# be sure to also uncomment the yawsid_opts line just below.
-#
-yawsid=default
-#yawsid_opts="--id $yawsid"
-conf="--conf %etcdir%/yaws/yaws.conf"
-
-start() {
- echo -n $"Starting $prog: "
- daemon $yaws ${yawsid_opts} --daemon ${heart} ${conf}
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && touch /var/lock/subsys/yaws
- return $RETVAL
-}
-
-stop() {
- echo -n $"Stopping $prog: "
- str=`$yaws ${yawsid_opts} --stop`
- if [ "$str" = "stopping yaws with id=\"$yawsid\"" ]; then
- echo_success
- RETVAL=0
- else
- echo_failure
- RETVAL=1
- fi
- echo
- rm -f /var/lock/subsys/yaws /var/run/yaws.pid
-}
-
-
-reload() {
- echo -n $"Reloading $prog: "
- r=`$yaws ${yawsid_opts} --hup`
- RETVAL=$?
- echo $r
-}
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- $yaws -S
- RETVAL=$?
- ;;
- restart)
- stop
- start
- ;;
- condrestart)
- if [ -f /tmp/yaws.ctl ] ; then
- stop
- start
- fi
- ;;
- reload)
- reload
- ;;
- help)
- $yaws -?
- ;;
- *)
- echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|help}"
- exit 1
-esac
-
-exit $RETVAL
View
181 scripts/regular-install
@@ -1,71 +1,132 @@
#!/bin/sh
-set -e
-
-p=${PREFIX}
-e=${ETCDIR}
-
install -d ${DESTDIR}${ETCDIR}
install -d ${DESTDIR}${VARDIR}/log/yaws
-## seems gentoo don't like to be installed in /usr/local/etc
-## since /sbin/runscript still reads /etc/conf.d
-if [ -f /etc/gentoo-release ]; then
- install -d ${DESTDIR}${ETCDIR}/init.d/
- install -d ${DESTDIR}${ETCDIR}/conf.d/
- install -d ${DESTDIR}${VARDIR}/run/yaws
- chmod a+rwx ${DESTDIR}${VARDIR}/run/yaws
- sed -e "s;%prefix%;$p;g" -e "s;%etcdir%;$e;g" \
- gentoo/init.d.yaws > ${DESTDIR}${ETCDIR}/init.d/yaws
- chmod +x ${DESTDIR}${ETCDIR}/init.d/yaws
+# Start by detecting if systemd is used
+(which systemctl && systemctl list-units) >/dev/null 2>&1
+if [ $? = 0 ]; then
+ install -d ${DESTDIR}${ETCDIR}/systemd/system/
+ sed -e "s;%prefix%;${PREFIX};g" \
+ -e "s;%etcdir%;${ETCDIR};g" \
+ -e "s;%bindir%;${BINDIR};g" \
+ systemd/yaws.service > ${DESTDIR}${ETCDIR}/systemd/system/yaws.service
+ exit 0
+fi
+
+# Else, looking at distro-specific files
+os=$( uname -s )
+which lsb_release >/dev/null 2>&1
+if [ $? = 0 ]; then
+ os=$( lsb_release -si )
+elif [ -f /etc/os-release ]; then
+ . /etc/os-release
+ os=${ID}
+elif [ -f /etc/arch-release ]; then
+ os="arch"
+elif [ -f /etc/gentoo-release ]; then
+ os="gentoo"
+elif [ -f /etc/fedora-release ]; then
+ os="fedora"
+elif [ -f /etc/centos-release ]; then
+ os="centos"
elif [ -f /etc/redhat-release ]; then
- install -d ${DESTDIR}${ETCDIR}/init.d
- install -d ${DESTDIR}${VARDIR}/run/yaws
- chmod a+rwx ${DESTDIR}${VARDIR}/run/yaws
- sed -e "s;%prefix%;$p;g" -e "s;%etcdir%;$e;g" \
- redhat/yaws.init.d > ${DESTDIR}${ETCDIR}/init.d/yaws
- chmod +x ${DESTDIR}${ETCDIR}/init.d/yaws
-elif [ -f /etc/SuSE-release -o -f /etc/suseservers ]; then
- install -d ${DESTDIR}${ETCDIR}/init.d
- install -d ${DESTDIR}${VARDIR}/run/yaws
- chmod a+rwx ${DESTDIR}${VARDIR}/run/yaws
- sed -e "s;%prefix%;$p;g" -e "s;%etcdir%;$e;g" \
- suse/yaws.init.d > ${DESTDIR}${ETCDIR}/init.d/yaws
- chmod +x ${DESTDIR}${ETCDIR}/init.d/yaws
+ os="redhat"
elif [ -f /etc/debian_version ]; then
- install -d ${DESTDIR}${ETCDIR}/init.d
- install -d ${DESTDIR}${VARDIR}/run/yaws
- chmod a+rwx ${DESTDIR}${VARDIR}/run/yaws
- sed -e "s;%prefix%;$p;g" -e "s;%etcdir%;$e;g" \
- debian/yaws.init.d > ${DESTDIR}${ETCDIR}/init.d/yaws
- chmod +x ${DESTDIR}${ETCDIR}/init.d/yaws
-
-elif [ "`uname -s`" = "Darwin" -a `id -u` = 0 ]; then
- startupdir="/Library/StartupItems/Yaws"
- if [ ! -e ${startupdir} ]; then
- mkdir ${startupdir};
- elif [ ! -d ${startupdir} ]; then
- echo "${startupdir} exists but is not a directory, bailing out ..."
- exit 1
- fi
- sed -e "s;%prefix%;$p;g" darwin/Yaws.StartupItem > ${startupdir}/Yaws
- chmod +x ${startupdir}/Yaws
- cp darwin/Yaws.plist ${startupdir}/StartupParameters.plist
- # MacOS is particular about the ownership of startup items.
- chown -R root:wheel ${startupdir}
-elif [ "`uname -s`" = "FreeBSD" ]; then
- install -d ${DESTDIR}${ETCDIR}/rc.d
- sed -e "s;%prefix%;$p;g" -e "s;%etcdir%;$e;g" \
- freebsd/yaws > ${DESTDIR}${ETCDIR}/rc.d/yaws
- chmod +x ${DESTDIR}${ETCDIR}/rc.d/yaws
-elif [ "`uname -s`" = "NetBSD" ]; then
- sed -e "s;%prefix%;$p;g" -e "s;%etcdir%;$e;g" \
- netbsd/yaws.sh > ${DESTDIR}${ETCDIR}/rc.d/yaws
- chmod +x /etc/rc.d/yaws
+ os="debian"
+elif [ -f /etc/SuSE-release ]; then
+ os="suse"
+elif [ $os = "Darwin" -a $(id -u) = 0 ]; then
+ os="darwin"
+elif [ $os = "FreeBSD" ]; then
+ os="freebsd"
+elif [ $os = "NetBSD" ]; then
+ os="netbsd"
else
- install -d ${DESTDIR}${ETCDIR}
- echo "Don't know how to make /etc/init scripts for this system"
- echo "possibly add ${PREFIX}/bin/yaws --daemon --heart to your /etc/rc.local manually"
+ os="Unknown"
fi
+case $(printf $os | tr '[:upper:]' '[:lower:]') in
+ debian | ubuntu)
+ install -d ${DESTDIR}${ETCDIR}/init.d
+ sed -e "s;%prefix%;${PREFIX};g" \
+ -e "s;%etcdir%;${ETCDIR};g" \
+ -e "s;%bindir%;${BINDIR};g" \
+ debian/yaws.init > ${DESTDIR}${ETCDIR}/init.d/yaws
+ chmod +x ${DESTDIR}${ETCDIR}/init.d/yaws
+ ;;
+
+ gentoo)
+ # seems gentoo don't like to be installed in /usr/local/etc since #
+ # /sbin/runscript still reads /etc/conf.d
+ install -d ${DESTDIR}${ETCDIR}/init.d
+ install -d ${DESTDIR}${ETCDIR}/conf.d
+ sed -e "s;%prefix%;${PREFIX};g" \
+ -e "s;%etcdir%;${ETCDIR};g" \
+ -e "s;%bindir%;${BINDIR};g" \
+ gentoo/yaws.init > ${DESTDIR}${ETCDIR}/init.d/yaws
+ chmod +x ${DESTDIR}${ETCDIR}/init.d/yaws
+ ;;
+
+ redhat | fedora | centos)
+ install -d ${DESTDIR}${ETCDIR}/init.d
+ sed -e "s;%prefix%;${PREFIX};g" \
+ -e "s;%etcdir%;${ETCDIR};g" \
+ -e "s;%bindir%;${BINDIR};g" \
+ redhat/yaws.init > ${DESTDIR}${ETCDIR}/init.d/yaws
+ chmod +x ${DESTDIR}${ETCDIR}/init.d/yaws
+ ;;
+
+ *suse*)
+ install -d ${DESTDIR}${ETCDIR}/init.d
+ sed -e "s;%prefix%;${PREFIX};g" \
+ -e "s;%etcdir%;${ETCDIR};g" \
+ -e "s;%bindir%;${BINDIR};g" \
+ suse/yaws.init > ${DESTDIR}${ETCDIR}/init.d/yaws
+ chmod +x ${DESTDIR}${ETCDIR}/init.d/yaws
+ ;;
+
+
+ darwin)
+ startupdir="/Library/StartupItems/Yaws"
+ if [ ! -e ${startupdir} ]; then
+ mkdir ${startupdir};
+ elif [ ! -d ${startupdir} ]; then
+ echo "${startupdir} exists but is not a directory, bailing out ..."
+ exit 1
+ fi
+ sed -e "s;%prefix%;${PREFIX};g" \
+ -e "s;%etcdir%;${ETCDIR};g" \
+ -e "s;%bindir%;${BINDIR};g" \
+ darwin/Yaws.StartupItem > ${startupdir}/Yaws
+ chmod +x ${startupdir}/Yaws
+ cp darwin/Yaws.plist ${startupdir}/StartupParameters.plist
+ # MacOS is particular about the ownership of startup items.
+ chown -R root:wheel ${startupdir}
+ ;;
+
+ freebsd)
+ install -d ${DESTDIR}${ETCDIR}/rc.d
+ sed -e "s;%prefix%;${PREFIX};g" \
+ -e "s;%etcdir%;${ETCDIR};g" \
+ -e "s;%bindir%;${BINDIR};g" \
+ freebsd/yaws > ${DESTDIR}${ETCDIR}/rc.d/yaws
+ chmod +x ${DESTDIR}${ETCDIR}/rc.d/yaws
+ ;;
+
+ netbsd)
+ sed -e "s;%prefix%;${PREFIX};g" \
+ -e "s;%etcdir%;${ETCDIR};g" \
+ -e "s;%bindir%;${BINDIR};g" \
+ netbsd/yaws.sh > ${DESTDIR}${ETCDIR}/rc.d/yaws
+ chmod +x /etc/rc.d/yaws
+ ;;
+ *)
+ install -d ${DESTDIR}${ETCDIR}
+ echo "Don't know how to make /etc/init scripts for this system"
+ echo "possibly add ${PREFIX}/bin/yaws --daemon --heart to your /etc/rc.local manually"
+ ;;
+esac
+
+
exit 0
View
141 scripts/suse/yaws.init
@@ -0,0 +1,141 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: yaws
+# Required-Start: $network $remote_fs
+# Should-Start: $null
+# Required-Stop: $network $remote_fs
+# Should-Stop: $null
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Short-Description: A high performance HTTP 1.1 webserver
+# Description: Yaws is a HTTP high perfomance 1.1 webserver
+# particularly well suited for dynamic-content
+# webapplications.
+### END INIT INFO
+
+
+YAWS_BIN=%bindir%/yaws
+
+## By default we run with the default id
+# YAWS_ID_OPTS=--id myserverid
+
+conf="--conf %etcdir%/yaws/yaws.conf"
+
+test -x $YAWS_BIN || exit 5
+
+
+
+# Shell functions sourced from /etc/rc.status:
+# rc_check check and set local and overall rc status
+# rc_status check and set local and overall rc status
+# rc_status -v ditto but be verbose in local rc status
+# rc_status -v -r ditto and clear the local rc status
+# rc_failed set local and overall rc status to failed
+# rc_failed <num> set local and overall rc status to <num><num>
+# rc_reset clear local rc status (overall remains)
+# rc_exit exit appropriate to overall rc status
+# rc_active checks whether a service is activated by symlinks
+. /etc/rc.status
+
+# First reset status of this service
+rc_reset
+
+# Return values acc. to LSB for all commands but status:
+# 0 - success
+# 1 - generic or unspecified error
+# 2 - invalid or excess argument(s)
+# 3 - unimplemented feature (e.g. "reload")
+# 4 - insufficient privilege
+# 5 - program is not installed
+# 6 - program is not configured
+# 7 - program is not running
+#
+# Note that starting an already running service, stopping
+# or restarting a not-running service as well as the restart
+# with force-reload (in case signalling is not supported) are
+# considered a success.
+
+case "$1" in
+ start)
+ echo -n "Starting YAWS"
+ ## Start daemon with startproc(8). If this fails
+ ## the echo return value is set appropriate.
+
+ # NOTE: startproc returns 0, even if service is
+ # already running to match LSB spec.
+ startproc $YAWS_BIN --daemon --heart $YAWS_ID_OPTS $conf
+ $YAWS_BIN $YAWS_ID_OPTS --wait-started=10 >/dev/null
+
+ # Remember status and be verbose
+ rc_status -v
+ ;;
+ stop)
+ echo -n "Shutting down YAWS"
+ ## Stop daemon with killproc(8) and if this fails
+ ## set echo the echo return value.
+ startproc $YAWS_BIN $YAWS_ID_OPTS --stop
+ $YAWS_BIN $YAWS_ID_OPTS --wait-stopped=10 >/dev/null
+
+ # Remember status and be verbose
+ rc_status -v
+ ;;
+ try-restart)
+ ## Stop the service and if this succeeds (i.e. the
+ ## service was running before), start it again.
+ ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
+ $0 status >/dev/null && $0 restart
+
+ # Remember status and be quiet
+ rc_status
+ ;;
+ restart)
+ ## Stop the service and regardless of whether it was
+ ## running or not, start it again.
+ $0 stop
+ $0 start
+
+ # Remember status and be quiet
+ rc_status
+ ;;
+ force-reload)
+ ## Signal the daemon to reload its config. Most daemons
+ ## do this on signal 1 (SIGHUP).
+ ## If it does not support it, restart.
+
+ echo -n "Force Reload service YAWS"
+ ## if it supports it:
+ $YAWS_BIN $YAWS_ID_OPTS --hup
+ rc_status -v
+
+ ;;
+ reload)
+ ## Like force-reload, but if daemon does not support
+ ## signalling, do nothing (!)
+
+ # If it supports signalling:
+
+ startproc $YAWS_BIN $YAWS_ID_OPTS --hup
+ rc_status -v
+
+ ;;
+ status)
+ echo -n "Checking for service YAWS: "
+ ## Check status with checkproc(8), if process is running
+ ## checkproc will return with exit status 0.
+
+ # Return value is slightly different for the status command:
+ # 0 - service running
+ # 1 - service dead, but /var/run/ pid file exists
+ # 2 - service dead, but /var/lock/ lock file exists
+ # 3 - service not running
+
+ # NOTE: checkproc returns LSB compliant status values.
+ checkproc $YAWS_BIN $YAWS_ID_OPTS --status
+ rc_status -v
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
+ exit 1
+ ;;
+esac
+rc_exit
View
133 scripts/suse/yaws.init.d
@@ -1,133 +0,0 @@
-#! /bin/sh
-
-
-YAWS_BIN=%prefix%/bin/yaws
-
-## By default we run with the default id
-# YAWS_ID_OPTS=--id myserverid
-
-conf="--conf %etcdir%/yaws/yaws.conf"
-
-test -x $YAWS_BIN || exit 5
-
-
-
-# Shell functions sourced from /etc/rc.status:
-# rc_check check and set local and overall rc status
-# rc_status check and set local and overall rc status
-# rc_status -v ditto but be verbose in local rc status
-# rc_status -v -r ditto and clear the local rc status
-# rc_failed set local and overall rc status to failed
-# rc_failed <num> set local and overall rc status to <num><num>
-# rc_reset clear local rc status (overall remains)
-# rc_exit exit appropriate to overall rc status
-# rc_active checks whether a service is activated by symlinks
-. /etc/rc.status
-
-# First reset status of this service
-rc_reset
-
-# Return values acc. to LSB for all commands but status:
-# 0 - success
-# 1 - generic or unspecified error
-# 2 - invalid or excess argument(s)
-# 3 - unimplemented feature (e.g. "reload")
-# 4 - insufficient privilege
-# 5 - program is not installed
-# 6 - program is not configured
-# 7 - program is not running
-#
-# Note that starting an already running service, stopping
-# or restarting a not-running service as well as the restart
-# with force-reload (in case signalling is not supported) are
-# considered a success.
-
-case "$1" in
- start)
- echo -n "Starting YAWS"
- ## Start daemon with startproc(8). If this fails
- ## the echo return value is set appropriate.
-
- # NOTE: startproc returns 0, even if service is
- # already running to match LSB spec.
- startproc $YAWS_BIN --daemon --heart ${YAWS_ID_OPTS} ${conf}
-
- # Remember status and be verbose
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down YAWS"
- ## Stop daemon with killproc(8) and if this fails
- ## set echo the echo return value.
-
- startproc $YAWS_BIN --stop ${YAWS_ID_OPTS}
-
- # Remember status and be verbose
- rc_status -v
- ;;
- try-restart)
- ## Stop the service and if this succeeds (i.e. the
- ## service was running before), start it again.
- ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
- $0 status >/dev/null && $0 restart
-
- # Remember status and be quiet
- rc_status
- ;;
- restart)
- ## Stop the service and regardless of whether it was
- ## running or not, start it again.
- $0 stop
- $0 start
-
- # Remember status and be quiet
- rc_status
- ;;
- force-reload)
- ## Signal the daemon to reload its config. Most daemons
- ## do this on signal 1 (SIGHUP).
- ## If it does not support it, restart.
-
- echo -n "Force Reload service YAWS"
- ## if it supports it:
- $YAWS_BIN ${YAWS_ID_OPTS} --hup
- rc_status -v
-
- ;;
- reload)
- ## Like force-reload, but if daemon does not support
- ## signalling, do nothing (!)
-
- # If it supports signalling:
-
- startproc $YAWS_BIN ${YAWS_ID_OPTS} --hup
- rc_status -v
-
- ;;
- status)
- echo -n "Checking for service FOO: "
- ## Check status with checkproc(8), if process is running
- ## checkproc will return with exit status 0.
-
- # Return value is slightly different for the status command:
- # 0 - service running
- # 1 - service dead, but /var/run/ pid file exists
- # 2 - service dead, but /var/lock/ lock file exists
- # 3 - service not running
-
- # NOTE: checkproc returns LSB compliant status values.
- checkproc $YAWS_BIN ${YAWS_ID_OPTS} --status
- rc_status -v
- ;;
- probe)
- ## Optional: Probe for the necessity of a reload,
- ## print out the argument which is required for a reload.
-
- test /etc/FOO/FOO.conf -nt /var/run/FOO.pid && echo reload
- ;;
- *)
- echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
- exit 1
- ;;
-esac
-rc_exit
View
24 scripts/systemd/yaws.service
@@ -0,0 +1,24 @@
+[Unit]
+Description=High performance HTTP 1.1 webserver written in Erlang
+After=network.target remote-fs.target
+
+[Service]
+Type=forking
+GuessMainPID=no
+
+Environment="YAWS_CONF=--conf %etcdir%/yaws/yaws.conf"
+#Environment="YAWS_ID=--id myserverid"
+
+ExecStart=%bindir%/yaws --daemon --heart $YAWS_CONF $YAWS_ID
+ExecStartPost=%bindir%/yaws $YAWS_ID --wait-started=10
+
+ExecReload=%bindir%/yaws $YAWS_ID --hup
+
+ExecStop=%bindir%/yaws $YAWS_ID --stop
+ExecStopPost=%bindir%/yaws $YAWS_ID --wait-stopped=10
+
+Restart=on-failure
+RestartSec=5
+
+[Install]
+WantedBy=multi-user.target
View
5 test/support/include.mk
@@ -21,7 +21,7 @@ ifeq ($(HAVE_ERLANG_SENDFILE),true)
endif
start: $(top_builddir)/test/bin/yaws quiet-stop prepare-test
- $(AM_V_at)$(top_builddir)/test/bin/yaws -sname test --daemon --id testid --conf $(YAWS_CONF)
+ $(AM_V_at)$(top_builddir)/test/bin/yaws --sname test --daemon --id testid --conf $(YAWS_CONF)
wait-started: $(top_builddir)/test/bin/yaws
$(AM_V_at)$(top_builddir)/test/bin/yaws --id testid --wait-started=$(WAIT_TIME)
@@ -43,7 +43,7 @@ status: $(top_builddir)/test/bin/yaws
$(AM_V_at)$(top_builddir)/test/bin/yaws --id testid --status >/dev/null
i: $(top_builddir)/test/bin/yaws
- $(AM_V_at)$(top_builddir)/test/bin/yaws -sname test -i --id testid --conf $(YAWS_CONF)
+ $(AM_V_at)$(top_builddir)/test/bin/yaws --sname test -i --id testid --conf $(YAWS_CONF)
connect: $(top_builddir)/test/bin/yaws
$(AM_V_at)$(ERL) -sname client -remsh test@`hostname`
@@ -57,6 +57,7 @@ do-test:
err=$$?; \
if test $$err -ne 0; then \
$(MAKE) quiet-stop; \
+ cat logs/report.log; \
fi; \
exit $$err
View
72 test/t1/Makefile.am
@@ -50,42 +50,62 @@ t2:
$(AM_V_at)$(SHELL) @srcdir@/runtest 131072 1048576 #8388608
t3:
- @echo "check-with-curl (max_num_cached_files = 0)"
- $(AM_V_at)cp $(YAWS_CONF).orig $(YAWS_CONF)
- $(AM_V_at)echo 'max_num_cached_files = 0' >> $(YAWS_CONF)
- $(AM_V_at)$(top_builddir)/test/bin/yaws --id testid --hup >/dev/null
- $(AM_V_at)$(CHECK_WITH_CURL)
+ $(AM_V_at)if [ -z $(CURL) ]; then \
+ echo "SKIPPED - curl is required to run these tests"; \
+ else \
+ echo "check-with-curl (max_num_cached_files = 0)"; \
+ cp $(YAWS_CONF).orig $(YAWS_CONF); \
+ echo 'max_num_cached_files = 0' >> $(YAWS_CONF); \
+ $(top_builddir)/test/bin/yaws --id testid --hup >/dev/null; \
+ $(CHECK_WITH_CURL); \
+ fi
t4:
- @echo "check-with-curl (max_num_cached_bytes = 0)"
- $(AM_V_at)cp $(YAWS_CONF).orig $(YAWS_CONF)
- $(AM_V_at)echo 'max_num_cached_bytes = 0' >> $(YAWS_CONF)
- $(AM_V_at)$(top_builddir)/test/bin/yaws --id testid --hup >/dev/null
- $(AM_V_at)$(CHECK_WITH_CURL)
+ $(AM_V_at)if [ -z $(CURL) ]; then \
+ echo "SKIPPED - curl is required to run these tests"; \
+ else \
+ echo "check-with-curl (max_num_cached_bytes = 0)"; \
+ cp $(YAWS_CONF).orig $(YAWS_CONF); \
+ echo 'max_num_cached_bytes = 0' >> $(YAWS_CONF); \
+ $(top_builddir)/test/bin/yaws --id testid --hup >/dev/null; \
+ $(CHECK_WITH_CURL); \
+ fi
t5:
- @echo "check-with-curl (max_size_cached_file = 0)"
- $(AM_V_at)cp $(YAWS_CONF).orig $(YAWS_CONF)
- $(AM_V_at)echo 'max_size_cached_file = 0' >> $(YAWS_CONF)
- $(AM_V_at)$(top_builddir)/test/bin/yaws --id testid --hup >/dev/null
- $(AM_V_at)$(CHECK_WITH_CURL)
+ $(AM_V_at)if [ -z $(CURL) ]; then \
+ echo "SKIPPED - curl is required to run these tests"; \
+ else \
+ echo "check-with-curl (max_size_cached_file = 0)"; \
+ cp $(YAWS_CONF).orig $(YAWS_CONF); \
+ echo 'max_size_cached_file = 0' >> $(YAWS_CONF); \
+ $(top_builddir)/test/bin/yaws --id testid --hup >/dev/null; \
+ $(CHECK_WITH_CURL); \
+ fi
t6:
- @echo "check-with-curl (max_num_cached_bytes = 5 / max_size_cached_file = 50)"
- $(AM_V_at)cp $(YAWS_CONF).orig $(YAWS_CONF)
- $(AM_V_at)echo 'max_num_cached_bytes = 5' >> $(YAWS_CONF)
- $(AM_V_at)echo 'max_size_cached_file = 50' >> $(YAWS_CONF)
- $(AM_V_at)$(top_builddir)/test/bin/yaws --id testid --hup >/dev/null
- $(AM_V_at)$(CHECK_WITH_CURL)
+ $(AM_V_at)if [ -z $(CURL) ]; then \
+ echo "SKIPPED - curl is required to run these tests"; \
+ else \
+ echo "check-with-curl (max_num_cached_bytes = 5 / max_size_cached_file = 50)";\
+ cp $(YAWS_CONF).orig $(YAWS_CONF); \
+ echo 'max_num_cached_bytes = 5' >> $(YAWS_CONF); \
+ echo 'max_size_cached_file = 50' >> $(YAWS_CONF); \
+ $(top_builddir)/test/bin/yaws --id testid --hup >/dev/null; \
+ $(CHECK_WITH_CURL); \
+ fi
# Verify redirection does not create URIs with multiple adjacent slashes Test
# submitted by James Lee
t7: newconf hup
- @echo "redirect test"
- $(AM_V_at)loc=`curl -s -m 5 -i http://localhost:8003/foo | \
- perl -ne 'print "$$1\n" if (m#Location:\s+http://(.+)#)' | \
- grep //`; \
- [ "${loc}" = "" ] && exit 0 || exit 1
+ $(AM_V_at)if [ -z $(CURL) ]; then \
+ echo "SKIPPED - curl is required to run these tests"; \
+ else \
+ echo "redirect test"; \
+ loc=`curl -s -m 5 -i http://localhost:8003/foo | \
+ perl -ne 'print "$$1\n" if (m#Location:\s+http://(.+)#)' | \
+ grep //`; \
+ [ "${loc}" = "" ] && exit 0 || exit 1; \
+ fi
json:
@echo "json test"
View
4 test/t11/app_test.erl
@@ -36,7 +36,7 @@ test_srcdir_v2() ->
?line ok = file:write_file(?builddir ++ "/include/srcdir_test.hrl",
<<"-define(SRCDIR_VERSION, \"2.0\").">>),
- {ok, Host} = inet:gethostname(),
+ [_, Host] = string:tokens(atom_to_list(node()), "@"),
Node = list_to_atom("test@" ++ Host),
?line Pid = rpc:call(Node, yaws, hup, [undefined]),
?line Ref = monitor(process, Pid),
@@ -58,7 +58,7 @@ test_srcdir_invalid() ->
?line ok = file:write_file(?builddir ++ "/include/srcdir_test.hrl",
<<"invalid_header">>),
- {ok, Host} = inet:gethostname(),
+ [_, Host] = string:tokens(atom_to_list(node()), "@"),
Node = list_to_atom("test@" ++ Host),
?line Pid = rpc:call(Node, yaws, hup, [undefined]),
?line Ref = monitor(process, Pid),
View
2  test/t7/app_test.erl
@@ -24,7 +24,7 @@ start() ->
test_generated_module() ->
io:format("generated_module_test\n", []),
- {ok, Host} = inet:gethostname(),
+ [_, Host] = string:tokens(atom_to_list(node()), "@"),
Node = list_to_atom("test@" ++ Host),
Vhost1 = {"localhost:8000", 8000},
Vhost2 = {"localhost:8001", 8001},
Please sign in to comment.
Something went wrong with that request. Please try again.