diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2016-05-01 23:10:52 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-05-02 15:56:07 +0200 |
commit | 64a99a719f23ef69193eb8e0027c040e5c74d3ee (patch) | |
tree | 9d59841b620cf162158019b0a45ab674609c88d0 /community/jetty-runner/jetty-runner.initd | |
parent | c9a5e74bb90bd6ec62bff392863b0a4be3f71294 (diff) | |
download | aports-64a99a719f23ef69193eb8e0027c040e5c74d3ee.tar.bz2 aports-64a99a719f23ef69193eb8e0027c040e5c74d3ee.tar.xz |
testing/jetty-runner: move to the community repo
Diffstat (limited to 'community/jetty-runner/jetty-runner.initd')
-rw-r--r-- | community/jetty-runner/jetty-runner.initd | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/community/jetty-runner/jetty-runner.initd b/community/jetty-runner/jetty-runner.initd new file mode 100644 index 0000000000..b96b0aa07c --- /dev/null +++ b/community/jetty-runner/jetty-runner.initd @@ -0,0 +1,79 @@ +#!/sbin/openrc-run + +: ${name:=${RC_SVCNAME}} +: ${pidfile:=/run/${RC_SVCNAME}.pid} +: ${user:=nobody} +: ${jetty_runner:=/usr/share/java/jetty-runner.jar} + +command="java" +command_background="true" + +start_stop_daemon_args="--quiet --user $user" +retry="SIGTERM/20" + +depend() { + need net +} + +start_pre() { + if [ "$RC_SVCNAME" = "jetty-runner" ]; then + ewarn "You are not supposed to run this runscript directly. Instead, you should" + ewarn "create a symlink for the application you want to run as well as a copy of" + ewarn "the configuration file and modify it appropriately, like so:" + ewarn "" + ewarn " ln -s jetty-runner /etc/init.d/myapp" + ewarn " cp /etc/conf.d/jetty-runner /etc/conf.d/myapp" + ewarn "" + fi + + if [ ! -e "$webapp_path" ]; then + eerror "File or directory '$webapp_path' does not exist!"; exit 1 + fi + + if [ -n "$server_out_log" ]; then + checkpath -d -o "$user" "$(dirname "$server_out_log")" + fi + + if [ -n "$server_access_log" ]; then + checkpath -d -o "$user" "$(dirname "$server_access_log")" + fi + + if [ -n "$server_port" ] && nc -z 127.0.0.1 "$server_port"; then + eerror "Port $server_port is already in use!"; exit 1 + fi + + java_opts=" + -server + ${java_heap_size:+ -Xms${java_heap_size}M -Xmx${java_heap_size}M} + ${java_new_ratio:+ -XX:NewRatio=${java_new_ratio}} + -Dfile.encoding=utf-8 + $java_opts" + + local item; for item in $java_properties; do + java_opts="$java_opts -D${item}" + done + + jetty_opts=" + $(optif --port "$server_port") + $(optif --host "$server_bind_address") + $(optif --out "$server_out_log") + $(optif --log "$server_access_log")" + + local path; for path in ${server_extra_jars//:/ }; do + if [ -f "$path" ]; then + jetty_opts="$jetty_opts --jar $path" + elif [ -d "$path" ]; then + jetty_opts="$jetty_opts --lib $path" + else + ewarn "JAR file or directory $path does not exist!" + fi + done + + jetty_opts="$jetty_opts $(optif --path "$context_root") $webapp_path" + + command_args="$java_opts -cp $jetty_runner org.eclipse.jetty.runner.Runner $jetty_opts" +} + +optif() { + test -n "$2" && echo "$1 $2" +} |