View | Details | Raw Unified | Return to bug 18964
Collapse All | Expand All

(-)a/debian/scripts/koha-plack (-8 / +56 lines)
Lines 1-6 Link Here
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
# Copyright 2015 Theke Solutions
3
# Copyright 2015 Theke Solutions
4
# Copyright 2016 Koha-Suomi
4
#
5
#
5
# This file is part of Koha.
6
# This file is part of Koha.
6
#
7
#
Lines 51-56 $scriptname -h|--help Link Here
51
    --restart             Restart the plack daemon for the specified instances
52
    --restart             Restart the plack daemon for the specified instances
52
    --enable              Enable plack for the specified instances
53
    --enable              Enable plack for the specified instances
53
    --disable             Disable plack for the specified instances
54
    --disable             Disable plack for the specified instances
55
    --debugger            Enable running Plack in debug mode
56
    --debugger-key        Specify the key the IDE is expecting
57
    --debugger-location   Specify the host:port for your debugger tool (defaults
58
                          to localhost:9000)
59
    --debugger-path       Specify the path for the debugger library
54
    --quiet|-q            Make the script quiet about non existent instance names
60
    --quiet|-q            Make the script quiet about non existent instance names
55
                          (useful for calling from another scripts).
61
                          (useful for calling from another scripts).
56
    --help|-h             Display this help message
62
    --help|-h             Display this help message
Lines 79-91 start_plack() Link Here
79
    PLACK_WORKERS=$(run_safe_xmlstarlet $instancename plack_workers)
85
    PLACK_WORKERS=$(run_safe_xmlstarlet $instancename plack_workers)
80
    [ -z $PLACK_WORKERS ] && PLACK_WORKERS="2"
86
    [ -z $PLACK_WORKERS ] && PLACK_WORKERS="2"
81
87
82
    STARMANOPTS="-M FindBin --max-requests ${PLACK_MAX_REQUESTS} --workers ${PLACK_WORKERS} \
88
    environment="deployment"
89
    daemonize="--daemonize"
90
    logging="--access-log /var/log/koha/${instancename}/plack.log \
91
             --error-log /var/log/koha/${instancename}/plack-error.log"
92
    max_requests_and_workers="--max-requests ${PLACK_MAX_REQUESTS} --workers ${PLACK_WORKERS}"
93
94
    if [ "$debug_mode" = "yes" ]; then
95
        environment="development"
96
        daemonize=""
97
        logging="" # remote debugger takes care
98
        max_requests_and_workers="--workers 1"
99
        STARMAN="/usr/bin/perl -d ${STARMAN}"
100
    fi
101
102
    STARMANOPTS="-M FindBin ${max_requests_and_workers} \
83
                 --user=${instancename}-koha --group ${instancename}-koha \
103
                 --user=${instancename}-koha --group ${instancename}-koha \
84
                 --pid ${PIDFILE} \
104
                 --pid ${PIDFILE} ${daemonize} ${logging} \
85
                 --daemonize \
105
                 -E ${environment} --socket ${PLACKSOCKET} ${PSGIFILE}"
86
                 --access-log /var/log/koha/${instancename}/plack.log \
87
                 --error-log /var/log/koha/${instancename}/plack-error.log \
88
                 -E deployment --socket ${PLACKSOCKET} ${PSGIFILE}"
89
106
90
    if ! is_plack_running ${instancename}; then
107
    if ! is_plack_running ${instancename}; then
91
        export KOHA_CONF="/etc/koha/sites/${instancename}/koha-conf.xml"
108
        export KOHA_CONF="/etc/koha/sites/${instancename}/koha-conf.xml"
Lines 239-244 set_action() Link Here
239
STARMAN=$(which starman)
256
STARMAN=$(which starman)
240
op=""
257
op=""
241
quiet="no"
258
quiet="no"
259
debug_mode="no"
260
debugger_key=""
261
debugger_location="localhost:9000"
262
debugger_path=""
242
263
243
# Read command line parameters
264
# Read command line parameters
244
while [ $# -gt 0 ]; do
265
while [ $# -gt 0 ]; do
Lines 264-269 while [ $# -gt 0 ]; do Link Here
264
        --disable)
285
        --disable)
265
            set_action "disable"
286
            set_action "disable"
266
            shift ;;
287
            shift ;;
288
        --debugger)
289
            debug_mode="yes"
290
            shift ;;
291
        --debugger-key)
292
            debugger_key="$2"
293
            shift 2 ;;
294
        --debugger-location)
295
            debugger_location="$2"
296
            shift 2 ;;
297
        --debugger-path)
298
            debugger_path="$2"
299
            shift 2 ;;
267
        -*)
300
        -*)
268
            die "Error: invalid option switch ($1)" ;;
301
            die "Error: invalid option switch ($1)" ;;
269
        *)
302
        *)
Lines 282-288 if [ $# -gt 0 ]; then Link Here
282
        if is_instance $name; then
315
        if is_instance $name; then
283
316
284
            adjust_paths_dev_install $name
317
            adjust_paths_dev_install $name
285
            export DEV_INSTALL KOHA_HOME PERL5LIB=$PERL5LIB:$KOHA_HOME/installer:$KOHA_HOME/lib/installer
318
            export DEV_INSTALL
319
            export KOHA_HOME
320
            PERL5LIB=$PERL5LIB:$KOHA_HOME/installer:$KOHA_HOME/lib/installer
321
            # If debug mode is enabled, add the debugger lib path
322
            # to PERL5LIB if appropriate
323
            if [ "$debug_mode" = "yes" ]; then
324
                if [ "$debugger_path" != "" ]; then
325
                    PERL5LIB="${debugger_path}":$PERL5LIB
326
                fi
327
                export PERL5DB="BEGIN { require q(${debugger_path}/perl5db.pl) }"
328
                export PERLDB_OPTS="RemotePort=${debugger_location} async=1 LogFile=/var/log/koha/${name}/plack-debug.log"
329
                export DBGP_IDEKEY=${debugger_key}
330
                export PLACK_DEBUG=1
331
                export PERL5OPT="-d"
332
            fi
333
334
            export PERL5LIB
286
335
287
            case $op in
336
            case $op in
288
                "start")
337
                "start")
289
- 

Return to bug 18964