dployr 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dployr/cli.rb +7 -0
- data/lib/dployr/commands/config.rb +1 -0
- data/lib/dployr/commands/execute.rb +1 -1
- data/lib/dployr/commands/info.rb +35 -0
- data/lib/dployr/commands/provision_test.rb +1 -1
- data/lib/dployr/commands/ssh.rb +1 -1
- data/lib/dployr/commands/start.rb +1 -1
- data/lib/dployr/commands/stop_destroy.rb +1 -1
- data/lib/dployr/compute/aws.rb +13 -3
- data/lib/dployr/compute/gce.rb +11 -3
- data/lib/dployr/scripts/default_hooks.rb +1 -1
- data/lib/dployr/scripts/local_shell.rb +6 -2
- data/lib/dployr/scripts/scp.rb +1 -1
- data/lib/dployr/scripts/shell.rb +6 -2
- data/lib/dployr/version.rb +1 -1
- data/lib/dployr.rb +1 -0
- data/spec/fixtures/german/Dployrfile.yml +4 -2
- data/spec/fixtures/german/real_test.rb +16 -0
- data/spec/fixtures/german/server_aws.info +0 -0
- data/spec/fixtures/german/server_gce.info +7565 -0
- metadata +12 -11
- data/spec/fixtures/hello/createExecUser.sh +0 -18
- data/spec/fixtures/hello/jetty +0 -562
- data/spec/fixtures/hello/jetty.sh +0 -28
- /data/spec/fixtures/{hello → german/hello}/hello.sh +0 -0
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dployr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Aparicio
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/dployr/commands/base.rb
|
134
134
|
- lib/dployr/commands/config.rb
|
135
135
|
- lib/dployr/commands/execute.rb
|
136
|
+
- lib/dployr/commands/info.rb
|
136
137
|
- lib/dployr/commands/provision_test.rb
|
137
138
|
- lib/dployr/commands/ssh.rb
|
138
139
|
- lib/dployr/commands/start.rb
|
@@ -165,10 +166,10 @@ files:
|
|
165
166
|
- spec/fixtures/Dployrfile.yml
|
166
167
|
- spec/fixtures/basic/Dployrfile.yml
|
167
168
|
- spec/fixtures/german/Dployrfile.yml
|
168
|
-
- spec/fixtures/hello/
|
169
|
-
- spec/fixtures/
|
170
|
-
- spec/fixtures/
|
171
|
-
- spec/fixtures/
|
169
|
+
- spec/fixtures/german/hello/hello.sh
|
170
|
+
- spec/fixtures/german/real_test.rb
|
171
|
+
- spec/fixtures/german/server_aws.info
|
172
|
+
- spec/fixtures/german/server_gce.info
|
172
173
|
- spec/fog_spec_.rb
|
173
174
|
- spec/init_spec.rb
|
174
175
|
- spec/spec_helper.rb
|
@@ -194,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
195
|
version: '0'
|
195
196
|
requirements: []
|
196
197
|
rubyforge_project: dployr
|
197
|
-
rubygems_version: 2.0.
|
198
|
+
rubygems_version: 2.0.3
|
198
199
|
signing_key:
|
199
200
|
specification_version: 4
|
200
201
|
summary: Multicloud management and deployment with asteroids made simple
|
@@ -208,10 +209,10 @@ test_files:
|
|
208
209
|
- spec/fixtures/Dployrfile.yml
|
209
210
|
- spec/fixtures/basic/Dployrfile.yml
|
210
211
|
- spec/fixtures/german/Dployrfile.yml
|
211
|
-
- spec/fixtures/hello/
|
212
|
-
- spec/fixtures/
|
213
|
-
- spec/fixtures/
|
214
|
-
- spec/fixtures/
|
212
|
+
- spec/fixtures/german/hello/hello.sh
|
213
|
+
- spec/fixtures/german/real_test.rb
|
214
|
+
- spec/fixtures/german/server_aws.info
|
215
|
+
- spec/fixtures/german/server_gce.info
|
215
216
|
- spec/fog_spec_.rb
|
216
217
|
- spec/init_spec.rb
|
217
218
|
- spec/spec_helper.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
createExecUser() {
|
4
|
-
USERNAME=$1
|
5
|
-
shift
|
6
|
-
DIRECTORIES=$@
|
7
|
-
|
8
|
-
NOLOGIN_PATH=$(which nologin)
|
9
|
-
sudo useradd -M -U -s $NOLOGIN_PATH $USERNAME
|
10
|
-
for dir in $DIRECTORIES; do
|
11
|
-
if [ ! -d $dir ]
|
12
|
-
then
|
13
|
-
sudo mkdir $dir
|
14
|
-
fi
|
15
|
-
echo "Change owner to $dir ..."
|
16
|
-
sudo chown -R ${USERNAME}:${USERNAME} $dir
|
17
|
-
done
|
18
|
-
}
|
data/spec/fixtures/hello/jetty
DELETED
@@ -1,562 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
#
|
3
|
-
# Startup script for jetty under *nix systems (it works under NT/cygwin too).
|
4
|
-
|
5
|
-
##################################################
|
6
|
-
# Set the name which is used by other variables.
|
7
|
-
# Defaults to the file name without extension.
|
8
|
-
##################################################
|
9
|
-
NAME=$(echo $(basename $0) | sed -e 's/^[SK][0-9]+//' -e 's/\.sh$//')
|
10
|
-
|
11
|
-
# To get the service to restart correctly on reboot, uncomment below (3 lines):
|
12
|
-
# ========================
|
13
|
-
# chkconfig: 3 99 99
|
14
|
-
# description: Jetty 9 webserver
|
15
|
-
# processname: jetty
|
16
|
-
# ========================
|
17
|
-
|
18
|
-
# Configuration files
|
19
|
-
#
|
20
|
-
# /etc/default/$NAME
|
21
|
-
# If it exists, this is read at the start of script. It may perform any
|
22
|
-
# sequence of shell commands, like setting relevant environment variables.
|
23
|
-
#
|
24
|
-
# $HOME/.$NAMErc (e.g. $HOME/.jettyrc)
|
25
|
-
# If it exists, this is read at the start of script. It may perform any
|
26
|
-
# sequence of shell commands, like setting relevant environment variables.
|
27
|
-
#
|
28
|
-
# /etc/$NAME.conf
|
29
|
-
# If found, and no configurations were given on the command line,
|
30
|
-
# the file will be used as this script's configuration.
|
31
|
-
# Each line in the file may contain:
|
32
|
-
# - A comment denoted by the pound (#) sign as first non-blank character.
|
33
|
-
# - The path to a regular file, which will be passed to jetty as a
|
34
|
-
# config.xml file.
|
35
|
-
# - The path to a directory. Each *.xml file in the directory will be
|
36
|
-
# passed to jetty as a config.xml file.
|
37
|
-
# - All other lines will be passed, as-is to the start.jar
|
38
|
-
#
|
39
|
-
# The files will be checked for existence before being passed to jetty.
|
40
|
-
#
|
41
|
-
# Configuration variables
|
42
|
-
#
|
43
|
-
# JAVA
|
44
|
-
# Command to invoke Java. If not set, java (from the PATH) will be used.
|
45
|
-
#
|
46
|
-
# JAVA_OPTIONS
|
47
|
-
# Extra options to pass to the JVM
|
48
|
-
#
|
49
|
-
# JETTY_HOME
|
50
|
-
# Where Jetty is installed. If not set, the script will try go
|
51
|
-
# guess it by first looking at the invocation path for the script,
|
52
|
-
# and then by looking in standard locations as $HOME/opt/jetty
|
53
|
-
# and /opt/jetty. The java system property "jetty.home" will be
|
54
|
-
# set to this value for use by configure.xml files, f.e.:
|
55
|
-
#
|
56
|
-
# <Arg><Property name="jetty.home" default="."/>/webapps/jetty.war</Arg>
|
57
|
-
#
|
58
|
-
# JETTY_BASE
|
59
|
-
# Where your Jetty base directory is. If not set, the value from
|
60
|
-
# $JETTY_HOME will be used.
|
61
|
-
#
|
62
|
-
# JETTY_RUN
|
63
|
-
# Where the $NAME.pid file should be stored. It defaults to the
|
64
|
-
# first available of /var/run, /usr/var/run, JETTY_BASE and /tmp
|
65
|
-
# if not set.
|
66
|
-
#
|
67
|
-
# JETTY_PID
|
68
|
-
# The Jetty PID file, defaults to $JETTY_RUN/$NAME.pid
|
69
|
-
#
|
70
|
-
# JETTY_ARGS
|
71
|
-
# The default arguments to pass to jetty.
|
72
|
-
# For example
|
73
|
-
# JETTY_ARGS=jetty.host=0.0.0.0 jetty.port=8080 jetty.spdy.port=8443 jetty.secure.port=443
|
74
|
-
#
|
75
|
-
# JETTY_USER
|
76
|
-
# if set, then used as a username to run the server as
|
77
|
-
|
78
|
-
JETTY_HOME=/opt/jetty
|
79
|
-
JETTY_USER=jetty
|
80
|
-
JETTY_PORT=8080
|
81
|
-
JETTY_LOGS=/var/log/jetty/
|
82
|
-
|
83
|
-
usage()
|
84
|
-
{
|
85
|
-
echo "Usage: ${0##*/} [-d] {start|stop|run|restart|check|supervise} [ CONFIGS ... ] "
|
86
|
-
exit 1
|
87
|
-
}
|
88
|
-
|
89
|
-
[ $# -gt 0 ] || usage
|
90
|
-
|
91
|
-
|
92
|
-
##################################################
|
93
|
-
# Some utility functions
|
94
|
-
##################################################
|
95
|
-
findDirectory()
|
96
|
-
{
|
97
|
-
local L OP=$1
|
98
|
-
shift
|
99
|
-
for L in "$@"; do
|
100
|
-
[ "$OP" "$L" ] || continue
|
101
|
-
printf %s "$L"
|
102
|
-
break
|
103
|
-
done
|
104
|
-
}
|
105
|
-
|
106
|
-
running()
|
107
|
-
{
|
108
|
-
local PID=$(cat "$1" 2>/dev/null) || return 1
|
109
|
-
kill -0 "$PID" 2>/dev/null
|
110
|
-
}
|
111
|
-
|
112
|
-
started()
|
113
|
-
{
|
114
|
-
# wait for 60s to see "STARTED" in PID file, needs jetty-started.xml as argument
|
115
|
-
for T in 1 2 3 4 5 6 7 9 10 11 12 13 14 15
|
116
|
-
do
|
117
|
-
sleep 4
|
118
|
-
[ -z "$(grep STARTED $1 2>/dev/null)" ] || return 0
|
119
|
-
[ -z "$(grep STOPPED $1 2>/dev/null)" ] || return 1
|
120
|
-
[ -z "$(grep FAILED $1 2>/dev/null)" ] || return 1
|
121
|
-
local PID=$(cat "$2" 2>/dev/null) || return 1
|
122
|
-
kill -0 "$PID" 2>/dev/null || return 1
|
123
|
-
echo -n ". "
|
124
|
-
done
|
125
|
-
|
126
|
-
return 1;
|
127
|
-
}
|
128
|
-
|
129
|
-
|
130
|
-
readConfig()
|
131
|
-
{
|
132
|
-
(( DEBUG )) && echo "Reading $1.."
|
133
|
-
source "$1"
|
134
|
-
}
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
##################################################
|
139
|
-
# Get the action & configs
|
140
|
-
##################################################
|
141
|
-
CONFIGS=()
|
142
|
-
NO_START=0
|
143
|
-
DEBUG=0
|
144
|
-
|
145
|
-
while [[ $1 = -* ]]; do
|
146
|
-
case $1 in
|
147
|
-
-d) DEBUG=1 ;;
|
148
|
-
esac
|
149
|
-
shift
|
150
|
-
done
|
151
|
-
ACTION=$1
|
152
|
-
shift
|
153
|
-
|
154
|
-
##################################################
|
155
|
-
# Read any configuration files
|
156
|
-
##################################################
|
157
|
-
ETC=/etc
|
158
|
-
if [ $UID != 0 ]
|
159
|
-
then
|
160
|
-
ETC=$HOME/etc
|
161
|
-
fi
|
162
|
-
|
163
|
-
for CONFIG in $ETC/default/${NAME}{,9} $HOME/.${NAME}rc; do
|
164
|
-
if [ -f "$CONFIG" ] ; then
|
165
|
-
readConfig "$CONFIG"
|
166
|
-
fi
|
167
|
-
done
|
168
|
-
|
169
|
-
|
170
|
-
##################################################
|
171
|
-
# Set tmp if not already set.
|
172
|
-
##################################################
|
173
|
-
TMPDIR=${TMPDIR:-/tmp}
|
174
|
-
|
175
|
-
##################################################
|
176
|
-
# Jetty's hallmark
|
177
|
-
##################################################
|
178
|
-
JETTY_INSTALL_TRACE_FILE="start.jar"
|
179
|
-
|
180
|
-
|
181
|
-
##################################################
|
182
|
-
# Try to determine JETTY_HOME if not set
|
183
|
-
##################################################
|
184
|
-
if [ -z "$JETTY_HOME" ]
|
185
|
-
then
|
186
|
-
JETTY_SH=$0
|
187
|
-
case "$JETTY_SH" in
|
188
|
-
/*) JETTY_HOME=${JETTY_SH%/*/*} ;;
|
189
|
-
./*/*) JETTY_HOME=${JETTY_SH%/*/*} ;;
|
190
|
-
./*) JETTY_HOME=.. ;;
|
191
|
-
*/*/*) JETTY_HOME=./${JETTY_SH%/*/*} ;;
|
192
|
-
*/*) JETTY_HOME=. ;;
|
193
|
-
*) JETTY_HOME=.. ;;
|
194
|
-
esac
|
195
|
-
|
196
|
-
if [ ! -f "$JETTY_HOME/$JETTY_INSTALL_TRACE_FILE" ]
|
197
|
-
then
|
198
|
-
JETTY_HOME=
|
199
|
-
fi
|
200
|
-
fi
|
201
|
-
|
202
|
-
|
203
|
-
##################################################
|
204
|
-
# No JETTY_HOME yet? We're out of luck!
|
205
|
-
##################################################
|
206
|
-
if [ -z "$JETTY_HOME" ]; then
|
207
|
-
echo "** ERROR: JETTY_HOME not set, you need to set it or install in a standard location"
|
208
|
-
exit 1
|
209
|
-
fi
|
210
|
-
|
211
|
-
cd "$JETTY_HOME"
|
212
|
-
JETTY_HOME=$PWD
|
213
|
-
|
214
|
-
|
215
|
-
##################################################
|
216
|
-
# Set JETTY_BASE
|
217
|
-
##################################################
|
218
|
-
if [ -z "$JETTY_BASE" ]; then
|
219
|
-
JETTY_BASE=$JETTY_HOME
|
220
|
-
fi
|
221
|
-
|
222
|
-
cd "$JETTY_BASE"
|
223
|
-
JETTY_BASE=$PWD
|
224
|
-
|
225
|
-
|
226
|
-
#####################################################
|
227
|
-
# Check that jetty is where we think it is
|
228
|
-
#####################################################
|
229
|
-
if [ ! -r "$JETTY_HOME/$JETTY_INSTALL_TRACE_FILE" ]
|
230
|
-
then
|
231
|
-
echo "** ERROR: Oops! Jetty doesn't appear to be installed in $JETTY_HOME"
|
232
|
-
echo "** ERROR: $JETTY_HOME/$JETTY_INSTALL_TRACE_FILE is not readable!"
|
233
|
-
exit 1
|
234
|
-
fi
|
235
|
-
|
236
|
-
##################################################
|
237
|
-
# Try to find this script's configuration file,
|
238
|
-
# but only if no configurations were given on the
|
239
|
-
# command line.
|
240
|
-
##################################################
|
241
|
-
if [ -z "$JETTY_CONF" ]
|
242
|
-
then
|
243
|
-
if [ -f $ETC/${NAME}.conf ]
|
244
|
-
then
|
245
|
-
JETTY_CONF=$ETC/${NAME}.conf
|
246
|
-
elif [ -f "$JETTY_BASE/etc/jetty.conf" ]
|
247
|
-
then
|
248
|
-
JETTY_CONF=$JETTY_BASE/etc/jetty.conf
|
249
|
-
elif [ -f "$JETTY_HOME/etc/jetty.conf" ]
|
250
|
-
then
|
251
|
-
JETTY_CONF=$JETTY_HOME/etc/jetty.conf
|
252
|
-
fi
|
253
|
-
fi
|
254
|
-
|
255
|
-
##################################################
|
256
|
-
# Get the list of config.xml files from jetty.conf
|
257
|
-
##################################################
|
258
|
-
if [ -f "$JETTY_CONF" ] && [ -r "$JETTY_CONF" ]
|
259
|
-
then
|
260
|
-
while read -r CONF
|
261
|
-
do
|
262
|
-
if expr "$CONF" : '#' >/dev/null ; then
|
263
|
-
continue
|
264
|
-
fi
|
265
|
-
|
266
|
-
if [ -d "$CONF" ]
|
267
|
-
then
|
268
|
-
# assume it's a directory with configure.xml files
|
269
|
-
# for example: /etc/jetty.d/
|
270
|
-
# sort the files before adding them to the list of JETTY_ARGS
|
271
|
-
for XMLFILE in "$CONF/"*.xml
|
272
|
-
do
|
273
|
-
if [ -r "$XMLFILE" ] && [ -f "$XMLFILE" ]
|
274
|
-
then
|
275
|
-
JETTY_ARGS+=("$XMLFILE")
|
276
|
-
else
|
277
|
-
echo "** WARNING: Cannot read '$XMLFILE' specified in '$JETTY_CONF'"
|
278
|
-
fi
|
279
|
-
done
|
280
|
-
else
|
281
|
-
# assume it's a command line parameter (let start.jar deal with its validity)
|
282
|
-
JETTY_ARGS+=("$CONF")
|
283
|
-
fi
|
284
|
-
done < "$JETTY_CONF"
|
285
|
-
fi
|
286
|
-
|
287
|
-
#####################################################
|
288
|
-
# Find a location for the pid file
|
289
|
-
#####################################################
|
290
|
-
if [ -z "$JETTY_RUN" ]
|
291
|
-
then
|
292
|
-
JETTY_RUN=$(findDirectory -w /var/run /usr/var/run $JETTY_BASE /tmp)
|
293
|
-
fi
|
294
|
-
|
295
|
-
#####################################################
|
296
|
-
# Find a pid and state file
|
297
|
-
#####################################################
|
298
|
-
if [ -z "$JETTY_PID" ]
|
299
|
-
then
|
300
|
-
JETTY_PID="$JETTY_RUN/${NAME}.pid"
|
301
|
-
fi
|
302
|
-
|
303
|
-
if [ -z "$JETTY_STATE" ]
|
304
|
-
then
|
305
|
-
JETTY_STATE=$JETTY_BASE/${NAME}.state
|
306
|
-
fi
|
307
|
-
JAVA_OPTIONS+=("-Djetty.state=$JETTY_STATE")
|
308
|
-
rm -f $JETTY_STATE
|
309
|
-
|
310
|
-
##################################################
|
311
|
-
# Setup JAVA if unset
|
312
|
-
##################################################
|
313
|
-
if [ -z "$JAVA" ]
|
314
|
-
then
|
315
|
-
JAVA=$(which java)
|
316
|
-
fi
|
317
|
-
|
318
|
-
if [ -z "$JAVA" ]
|
319
|
-
then
|
320
|
-
echo "Cannot find a Java JDK. Please set either set JAVA or put java (>=1.5) in your PATH." 2>&2
|
321
|
-
exit 1
|
322
|
-
fi
|
323
|
-
|
324
|
-
#####################################################
|
325
|
-
# See if JETTY_LOGS is defined
|
326
|
-
#####################################################
|
327
|
-
if [ -z "$JETTY_LOGS" ] && [ -d $JETTY_BASE/logs ]
|
328
|
-
then
|
329
|
-
JETTY_LOGS=$JETTY_BASE/logs
|
330
|
-
fi
|
331
|
-
if [ -z "$JETTY_LOGS" ] && [ -d $JETTY_HOME/logs ]
|
332
|
-
then
|
333
|
-
JETTY_LOGS=$JETTY_HOME/logs
|
334
|
-
fi
|
335
|
-
if [ "$JETTY_LOGS" ]
|
336
|
-
then
|
337
|
-
JAVA_OPTIONS+=("-Djetty.logs=$JETTY_LOGS")
|
338
|
-
fi
|
339
|
-
|
340
|
-
#####################################################
|
341
|
-
# Are we running on Windows? Could be, with Cygwin/NT.
|
342
|
-
#####################################################
|
343
|
-
case "`uname`" in
|
344
|
-
CYGWIN*) PATH_SEPARATOR=";";;
|
345
|
-
*) PATH_SEPARATOR=":";;
|
346
|
-
esac
|
347
|
-
|
348
|
-
|
349
|
-
#####################################################
|
350
|
-
# Add jetty properties to Java VM options.
|
351
|
-
#####################################################
|
352
|
-
JAVA_OPTIONS+=("-Djetty.home=$JETTY_HOME" "-Djetty.base=$JETTY_BASE" "-Djava.io.tmpdir=$TMPDIR")
|
353
|
-
|
354
|
-
#####################################################
|
355
|
-
# This is how the Jetty server will be started
|
356
|
-
#####################################################
|
357
|
-
|
358
|
-
JETTY_START=$JETTY_HOME/start.jar
|
359
|
-
START_INI=$JETTY_BASE/start.ini
|
360
|
-
if [ ! -f "$START_INI" ]
|
361
|
-
then
|
362
|
-
echo "Cannot find a start.ini in your JETTY_BASE directory: $JETTY_BASE" 2>&2
|
363
|
-
exit 1
|
364
|
-
fi
|
365
|
-
|
366
|
-
RUN_ARGS=(${JAVA_OPTIONS[@]} -jar "$JETTY_START" ${JETTY_ARGS[*]})
|
367
|
-
RUN_CMD=("$JAVA" ${RUN_ARGS[@]})
|
368
|
-
|
369
|
-
#####################################################
|
370
|
-
# Comment these out after you're happy with what
|
371
|
-
# the script is doing.
|
372
|
-
#####################################################
|
373
|
-
if (( DEBUG ))
|
374
|
-
then
|
375
|
-
echo "START_INI = $START_INI"
|
376
|
-
echo "JETTY_HOME = $JETTY_HOME"
|
377
|
-
echo "JETTY_BASE = $JETTY_BASE"
|
378
|
-
echo "JETTY_CONF = $JETTY_CONF"
|
379
|
-
echo "JETTY_PID = $JETTY_PID"
|
380
|
-
echo "JETTY_START = $JETTY_START"
|
381
|
-
echo "JETTY_ARGS = ${JETTY_ARGS[*]}"
|
382
|
-
echo "JAVA_OPTIONS = ${JAVA_OPTIONS[*]}"
|
383
|
-
echo "JAVA = $JAVA"
|
384
|
-
echo "RUN_CMD = ${RUN_CMD}"
|
385
|
-
fi
|
386
|
-
|
387
|
-
##################################################
|
388
|
-
# Do the action
|
389
|
-
##################################################
|
390
|
-
case "$ACTION" in
|
391
|
-
start)
|
392
|
-
echo -n "Starting Jetty: "
|
393
|
-
|
394
|
-
if (( NO_START )); then
|
395
|
-
echo "Not starting ${NAME} - NO_START=1";
|
396
|
-
exit
|
397
|
-
fi
|
398
|
-
|
399
|
-
if [ $UID -eq 0 ] && type start-stop-daemon > /dev/null 2>&1
|
400
|
-
then
|
401
|
-
unset CH_USER
|
402
|
-
if [ -n "$JETTY_USER" ]
|
403
|
-
then
|
404
|
-
CH_USER="-c$JETTY_USER"
|
405
|
-
fi
|
406
|
-
|
407
|
-
start-stop-daemon -S -p"$JETTY_PID" $CH_USER -d"$JETTY_HOME" -b -m -a "$JAVA" -- "${RUN_ARGS[@]}" --daemon
|
408
|
-
|
409
|
-
else
|
410
|
-
|
411
|
-
if [ -f "$JETTY_PID" ]
|
412
|
-
then
|
413
|
-
if running $JETTY_PID
|
414
|
-
then
|
415
|
-
echo "Already Running!"
|
416
|
-
exit 1
|
417
|
-
else
|
418
|
-
# dead pid file - remove
|
419
|
-
rm -f "$JETTY_PID"
|
420
|
-
fi
|
421
|
-
fi
|
422
|
-
|
423
|
-
if [ "$JETTY_USER" ]
|
424
|
-
then
|
425
|
-
touch "$JETTY_PID"
|
426
|
-
chown "$JETTY_USER" "$JETTY_PID"
|
427
|
-
# FIXME: Broken solution: wordsplitting, pathname expansion, arbitrary command execution, etc.
|
428
|
-
su - "$JETTY_USER" -c "
|
429
|
-
exec ${RUN_CMD[*]} --daemon &
|
430
|
-
disown \$!
|
431
|
-
echo \$! > '$JETTY_PID'"
|
432
|
-
else
|
433
|
-
"${RUN_CMD[@]}" &
|
434
|
-
disown $!
|
435
|
-
echo $! > "$JETTY_PID"
|
436
|
-
fi
|
437
|
-
|
438
|
-
fi
|
439
|
-
|
440
|
-
if expr "${JETTY_ARGS[*]}" : '.*jetty-started.xml.*' >/dev/null
|
441
|
-
then
|
442
|
-
if started "$JETTY_STATE" "$JETTY_PID"
|
443
|
-
then
|
444
|
-
echo "OK `date`"
|
445
|
-
else
|
446
|
-
echo "FAILED `date`"
|
447
|
-
fi
|
448
|
-
else
|
449
|
-
echo "ok `date`"
|
450
|
-
fi
|
451
|
-
|
452
|
-
;;
|
453
|
-
|
454
|
-
stop)
|
455
|
-
echo -n "Stopping Jetty: "
|
456
|
-
if [ $UID -eq 0 ] && type start-stop-daemon > /dev/null 2>&1; then
|
457
|
-
start-stop-daemon -K -p"$JETTY_PID" -d"$JETTY_HOME" -a "$JAVA" -s HUP
|
458
|
-
|
459
|
-
TIMEOUT=30
|
460
|
-
while running "$JETTY_PID"; do
|
461
|
-
if (( TIMEOUT-- == 0 )); then
|
462
|
-
start-stop-daemon -K -p"$JETTY_PID" -d"$JETTY_HOME" -a "$JAVA" -s KILL
|
463
|
-
fi
|
464
|
-
|
465
|
-
sleep 1
|
466
|
-
done
|
467
|
-
|
468
|
-
rm -f "$JETTY_PID"
|
469
|
-
echo OK
|
470
|
-
else
|
471
|
-
PID=$(cat "$JETTY_PID" 2>/dev/null)
|
472
|
-
kill "$PID" 2>/dev/null
|
473
|
-
|
474
|
-
TIMEOUT=30
|
475
|
-
while running $JETTY_PID; do
|
476
|
-
if (( TIMEOUT-- == 0 )); then
|
477
|
-
kill -KILL "$PID" 2>/dev/null
|
478
|
-
fi
|
479
|
-
|
480
|
-
sleep 1
|
481
|
-
done
|
482
|
-
|
483
|
-
rm -f "$JETTY_PID"
|
484
|
-
echo OK
|
485
|
-
fi
|
486
|
-
|
487
|
-
;;
|
488
|
-
|
489
|
-
restart)
|
490
|
-
JETTY_SH=$0
|
491
|
-
if [ ! -f $JETTY_SH ]; then
|
492
|
-
if [ ! -f $JETTY_HOME/bin/jetty.sh ]; then
|
493
|
-
echo "$JETTY_HOME/bin/jetty.sh does not exist."
|
494
|
-
exit 1
|
495
|
-
fi
|
496
|
-
JETTY_SH=$JETTY_HOME/bin/jetty.sh
|
497
|
-
fi
|
498
|
-
|
499
|
-
"$JETTY_SH" stop "$@"
|
500
|
-
"$JETTY_SH" start "$@"
|
501
|
-
|
502
|
-
;;
|
503
|
-
|
504
|
-
supervise)
|
505
|
-
#
|
506
|
-
# Under control of daemontools supervise monitor which
|
507
|
-
# handles restarts and shutdowns via the svc program.
|
508
|
-
#
|
509
|
-
exec "${RUN_CMD[@]}"
|
510
|
-
|
511
|
-
;;
|
512
|
-
|
513
|
-
run|demo)
|
514
|
-
echo "Running Jetty: "
|
515
|
-
|
516
|
-
if [ -f "$JETTY_PID" ]
|
517
|
-
then
|
518
|
-
if running "$JETTY_PID"
|
519
|
-
then
|
520
|
-
echo "Already Running!"
|
521
|
-
exit 1
|
522
|
-
else
|
523
|
-
# dead pid file - remove
|
524
|
-
rm -f "$JETTY_PID"
|
525
|
-
fi
|
526
|
-
fi
|
527
|
-
|
528
|
-
exec "${RUN_CMD[@]}"
|
529
|
-
;;
|
530
|
-
|
531
|
-
check|status)
|
532
|
-
echo "Checking arguments to Jetty: "
|
533
|
-
echo "START_INI = $START_INI"
|
534
|
-
echo "JETTY_HOME = $JETTY_HOME"
|
535
|
-
echo "JETTY_BASE = $JETTY_BASE"
|
536
|
-
echo "JETTY_CONF = $JETTY_CONF"
|
537
|
-
echo "JETTY_PID = $JETTY_PID"
|
538
|
-
echo "JETTY_START = $JETTY_START"
|
539
|
-
echo "JETTY_LOGS = $JETTY_LOGS"
|
540
|
-
echo "CLASSPATH = $CLASSPATH"
|
541
|
-
echo "JAVA = $JAVA"
|
542
|
-
echo "JAVA_OPTIONS = ${JAVA_OPTIONS[*]}"
|
543
|
-
echo "JETTY_ARGS = ${JETTY_ARGS[*]}"
|
544
|
-
echo "RUN_CMD = ${RUN_CMD[*]}"
|
545
|
-
echo
|
546
|
-
|
547
|
-
if [ -f "$JETTY_PID" ]
|
548
|
-
then
|
549
|
-
echo "Jetty running pid=$(< "$JETTY_PID")"
|
550
|
-
exit 0
|
551
|
-
fi
|
552
|
-
exit 1
|
553
|
-
|
554
|
-
;;
|
555
|
-
|
556
|
-
*)
|
557
|
-
usage
|
558
|
-
|
559
|
-
;;
|
560
|
-
esac
|
561
|
-
|
562
|
-
exit 0
|
@@ -1,28 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
source /tmp/hello/createExecUser.sh
|
3
|
-
|
4
|
-
# Install JRE 1.7
|
5
|
-
# sudo yum install java-1.7.0-openjdk.x86_64 -y
|
6
|
-
# sudo alternatives --set java /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
|
7
|
-
|
8
|
-
# Install & Run Jetty
|
9
|
-
if [ ! -d /opt/jetty ]
|
10
|
-
then
|
11
|
-
#wget http://download.eclipse.org/jetty/9.1.1.v20140108/dist/jetty-distribution-9.1.1.v20140108.tar.gz -O jetty.tar.gz
|
12
|
-
#wget http://cdn.mirror.garr.it/mirror3/mirrors/eclipse//jetty/9.1.0.v20131115/dist/jetty-distribution-9.1.0.v20131115.tar.gz -O jetty.tar.gz
|
13
|
-
wget http://eclipse.mirror.triple-it.nl/jetty/stable-9/dist/jetty-distribution-9.1.4.v20140401.tar.gz -O jetty.tar.gz
|
14
|
-
tar -xf jetty.tar.gz
|
15
|
-
rm jetty.tar.gz
|
16
|
-
mv jetty-* jetty
|
17
|
-
sudo mv jetty /opt/
|
18
|
-
sudo /usr/sbin/useradd jetty
|
19
|
-
sudo mkdir /var/log/jetty
|
20
|
-
sudo chown -R jetty:jetty /var/log/jetty /opt/jetty
|
21
|
-
fi
|
22
|
-
|
23
|
-
sudo cp /tmp/hello/jetty /etc/init.d
|
24
|
-
sudo chmod a+x /etc/init.d/jetty
|
25
|
-
sudo chkconfig --add jetty
|
26
|
-
sudo chkconfig jetty on
|
27
|
-
sudo service jetty restart
|
28
|
-
|
File without changes
|