blob: b96b0aa07cfde922b580125cdd36df1d5cec0b9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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"
}
|