Lines 62-67
$scriptname -h|--help
Link Here
|
62 |
--debugger-path Specify the path for the debugger library |
62 |
--debugger-path Specify the path for the debugger library |
63 |
--quiet|-q Make the script quiet about non existent instance names |
63 |
--quiet|-q Make the script quiet about non existent instance names |
64 |
(useful for calling from another scripts). |
64 |
(useful for calling from another scripts). |
|
|
65 |
--watch|-w Enable automatic reload to starman/plack when a file |
66 |
is modified (intended for development use) |
65 |
--help|-h Display this help message |
67 |
--help|-h Display this help message |
66 |
|
68 |
|
67 |
EOF |
69 |
EOF |
Lines 131-136
start_plack()
Link Here
|
131 |
# Go back to the original dir |
133 |
# Go back to the original dir |
132 |
cd "$current_dir" |
134 |
cd "$current_dir" |
133 |
|
135 |
|
|
|
136 |
# start watcher |
137 |
if [ "${watch}" = "yes" ]; then |
138 |
start_watcher "$instancename" |
139 |
fi |
140 |
|
134 |
else |
141 |
else |
135 |
log_daemon_msg "Error: Plack already running for ${instancename}" |
142 |
log_daemon_msg "Error: Plack already running for ${instancename}" |
136 |
log_end_msg 1 |
143 |
log_end_msg 1 |
Lines 145-163
stop_plack()
Link Here
|
145 |
|
152 |
|
146 |
if is_plack_running ${instancename}; then |
153 |
if is_plack_running ${instancename}; then |
147 |
|
154 |
|
|
|
155 |
# stop watcher |
156 |
if [ -f "/var/run/koha/${instancename}/watcher.pid" ]; then |
157 |
stop_watcher "$instancename" |
158 |
fi |
159 |
|
148 |
log_daemon_msg "Stopping Plack daemon for ${instancename}" |
160 |
log_daemon_msg "Stopping Plack daemon for ${instancename}" |
149 |
|
161 |
|
150 |
if start-stop-daemon --pidfile ${PIDFILE} --user="${instancename}-koha" --stop --retry=QUIT/30/KILL/5; then |
162 |
if start-stop-daemon --pidfile "${PIDFILE}" --user="${instancename}-koha" --stop --retry=QUIT/30/KILL/5; then |
151 |
log_end_msg 0 |
163 |
log_end_msg 0 |
152 |
else |
164 |
else |
153 |
log_end_msg 1 |
165 |
log_end_msg 1 |
154 |
fi |
166 |
fi |
|
|
167 |
|
155 |
else |
168 |
else |
156 |
log_daemon_msg "Error: Plack not running for ${instancename}" |
169 |
log_daemon_msg "Error: Plack not running for ${instancename}" |
157 |
log_end_msg 1 |
170 |
log_end_msg 1 |
158 |
fi |
171 |
fi |
159 |
} |
172 |
} |
160 |
|
173 |
|
|
|
174 |
|
161 |
restart_plack() |
175 |
restart_plack() |
162 |
{ |
176 |
{ |
163 |
local instancename=$1 |
177 |
local instancename=$1 |
Lines 294-299
disable_plack()
Link Here
|
294 |
fi |
308 |
fi |
295 |
} |
309 |
} |
296 |
|
310 |
|
|
|
311 |
start_watcher() |
312 |
{ |
313 |
local instancename="$1" |
314 |
local PIDFILE="/var/run/koha/${instancename}/watcher.pid" |
315 |
|
316 |
start-stop-daemon --pidfile "$PIDFILE" --start --background \ |
317 |
--make-pidfile --startas /usr/sbin/koha-watcher \ |
318 |
-- -d $KOHA_HOME "$instancename" |
319 |
} |
320 |
|
321 |
stop_watcher() |
322 |
{ |
323 |
local instancename="$1" |
324 |
local PIDFILE="/var/run/koha/$instancename/watcher.pid" |
325 |
local PID=$(cat "$PIDFILE") |
326 |
|
327 |
start-stop-daemon --ppid "$PID" --stop -v |
328 |
rm "$PIDFILE" |
329 |
} |
330 |
|
297 |
check_env_and_warn() |
331 |
check_env_and_warn() |
298 |
{ |
332 |
{ |
299 |
local apache_version_ok="no" |
333 |
local apache_version_ok="no" |
Lines 401-406
_do_instance() {
Link Here
|
401 |
STARMAN=$(which starman) |
435 |
STARMAN=$(which starman) |
402 |
op="" |
436 |
op="" |
403 |
quiet="no" |
437 |
quiet="no" |
|
|
438 |
watch="no" |
404 |
debug_mode="no" |
439 |
debug_mode="no" |
405 |
debugger_key="" |
440 |
debugger_key="" |
406 |
debugger_location="localhost:9000" |
441 |
debugger_location="localhost:9000" |
Lines 415-420
while [ $# -gt 0 ]; do
Link Here
|
415 |
-q|--quiet) |
450 |
-q|--quiet) |
416 |
quiet="yes" |
451 |
quiet="yes" |
417 |
shift ;; |
452 |
shift ;; |
|
|
453 |
-w|--watch) |
454 |
watch="yes" |
455 |
shift ;; |
418 |
--start) |
456 |
--start) |
419 |
set_action "start" |
457 |
set_action "start" |
420 |
shift ;; |
458 |
shift ;; |