|
Lines 58-68
EOF
Link Here
|
| 58 |
start_worker() |
58 |
start_worker() |
| 59 |
{ |
59 |
{ |
| 60 |
local name=$1 |
60 |
local name=$1 |
|
|
61 |
local queue=$2 |
| 62 |
|
| 63 |
if ! is_worker_running $name $queue; then |
| 64 |
|
| 65 |
worker_name=`get_worker_name $name $queue` |
| 61 |
|
66 |
|
| 62 |
if ! is_worker_running $name; then |
|
|
| 63 |
export KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" |
67 |
export KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" |
| 64 |
|
68 |
|
| 65 |
DAEMONOPTS="--name=$name-koha-worker \ |
69 |
DAEMONOPTS="--name=${worker_name} \ |
| 66 |
--errlog=/var/log/koha/$name/worker-error.log \ |
70 |
--errlog=/var/log/koha/$name/worker-error.log \ |
| 67 |
--stdout=/var/log/koha/$name/worker.log \ |
71 |
--stdout=/var/log/koha/$name/worker.log \ |
| 68 |
--output=/var/log/koha/$name/worker-output.log \ |
72 |
--output=/var/log/koha/$name/worker-output.log \ |
|
Lines 70-84
start_worker()
Link Here
|
| 70 |
--verbose=1 --respawn --delay=30 \ |
74 |
--verbose=1 --respawn --delay=30 \ |
| 71 |
--user=$name-koha.$name-koha" |
75 |
--user=$name-koha.$name-koha" |
| 72 |
|
76 |
|
| 73 |
log_daemon_msg "Starting Koha worker daemon for $name" |
77 |
log_daemon_msg "Starting Koha worker daemon for $name ($queue)" |
| 74 |
|
78 |
|
| 75 |
if daemon $DAEMONOPTS -- $worker_DAEMON; then |
79 |
if daemon $DAEMONOPTS -- $worker_DAEMON --job-queue ${queue}; then |
| 76 |
log_end_msg 0 |
80 |
log_end_msg 0 |
| 77 |
else |
81 |
else |
| 78 |
log_end_msg 1 |
82 |
log_end_msg 1 |
| 79 |
fi |
83 |
fi |
| 80 |
else |
84 |
else |
| 81 |
log_daemon_msg "Error: worker already running for $name" |
85 |
log_daemon_msg "Error: worker already running for $name ($queue)" |
| 82 |
log_end_msg 1 |
86 |
log_end_msg 1 |
| 83 |
fi |
87 |
fi |
| 84 |
} |
88 |
} |
|
Lines 86-96
start_worker()
Link Here
|
| 86 |
stop_worker() |
90 |
stop_worker() |
| 87 |
{ |
91 |
{ |
| 88 |
local name=$1 |
92 |
local name=$1 |
|
|
93 |
local queue=$2 |
| 89 |
|
94 |
|
| 90 |
if is_worker_running $name; then |
95 |
if is_worker_running $name $queue; then |
| 91 |
export KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" |
96 |
export KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" |
| 92 |
|
97 |
|
| 93 |
DAEMONOPTS="--name=$name-koha-worker \ |
98 |
worker_name=`get_worker_name $name $queue` |
|
|
99 |
|
| 100 |
DAEMONOPTS="--name=${worker_name} \ |
| 94 |
--errlog=/var/log/koha/$name/worker-error.log \ |
101 |
--errlog=/var/log/koha/$name/worker-error.log \ |
| 95 |
--stdout=/var/log/koha/$name/worker.log \ |
102 |
--stdout=/var/log/koha/$name/worker.log \ |
| 96 |
--output=/var/log/koha/$name/worker-output.log \ |
103 |
--output=/var/log/koha/$name/worker-output.log \ |
|
Lines 98-112
stop_worker()
Link Here
|
| 98 |
--verbose=1 --respawn --delay=30 \ |
105 |
--verbose=1 --respawn --delay=30 \ |
| 99 |
--user=$name-koha.$name-koha" |
106 |
--user=$name-koha.$name-koha" |
| 100 |
|
107 |
|
| 101 |
log_daemon_msg "Stopping Koha worker daemon for $name" |
108 |
log_daemon_msg "Stopping Koha worker daemon for $name ($queue)" |
| 102 |
|
109 |
|
| 103 |
if daemon $DAEMONOPTS --stop -- $worker_DAEMON; then |
110 |
if daemon $DAEMONOPTS --stop -- $worker_DAEMON --job-queue ${queue}; then |
| 104 |
log_end_msg 0 |
111 |
log_end_msg 0 |
| 105 |
else |
112 |
else |
| 106 |
log_end_msg 1 |
113 |
log_end_msg 1 |
| 107 |
fi |
114 |
fi |
| 108 |
else |
115 |
else |
| 109 |
log_daemon_msg "Error: worker not running for $name" |
116 |
log_daemon_msg "Error: worker not running for $name ($queue)" |
| 110 |
log_end_msg 1 |
117 |
log_end_msg 1 |
| 111 |
fi |
118 |
fi |
| 112 |
} |
119 |
} |
|
Lines 114-124
stop_worker()
Link Here
|
| 114 |
restart_worker() |
121 |
restart_worker() |
| 115 |
{ |
122 |
{ |
| 116 |
local name=$1 |
123 |
local name=$1 |
|
|
124 |
local queue=$2 |
| 117 |
|
125 |
|
| 118 |
if is_worker_running $name; then |
126 |
if is_worker_running $name $queue; then |
| 119 |
export KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" |
127 |
export KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" |
| 120 |
|
128 |
|
| 121 |
DAEMONOPTS="--name=$name-koha-worker \ |
129 |
worker_name=`get_worker_name $name $queue` |
|
|
130 |
|
| 131 |
DAEMONOPTS="--name=${worker_name} \ |
| 122 |
--errlog=/var/log/koha/$name/worker-error.log \ |
132 |
--errlog=/var/log/koha/$name/worker-error.log \ |
| 123 |
--stdout=/var/log/koha/$name/worker.log \ |
133 |
--stdout=/var/log/koha/$name/worker.log \ |
| 124 |
--output=/var/log/koha/$name/worker-output.log \ |
134 |
--output=/var/log/koha/$name/worker-output.log \ |
|
Lines 126-140
restart_worker()
Link Here
|
| 126 |
--verbose=1 --respawn --delay=30 \ |
136 |
--verbose=1 --respawn --delay=30 \ |
| 127 |
--user=$name-koha.$name-koha" |
137 |
--user=$name-koha.$name-koha" |
| 128 |
|
138 |
|
| 129 |
log_daemon_msg "Restarting Koha worker daemon for $name" |
139 |
log_daemon_msg "Restarting Koha worker daemon for $name ($queue)" |
| 130 |
|
140 |
|
| 131 |
if daemon $DAEMONOPTS --restart -- $worker_DAEMON; then |
141 |
if daemon $DAEMONOPTS --restart -- $worker_DAEMON --job-queue ${queue}; then |
| 132 |
log_end_msg 0 |
142 |
log_end_msg 0 |
| 133 |
else |
143 |
else |
| 134 |
log_end_msg 1 |
144 |
log_end_msg 1 |
| 135 |
fi |
145 |
fi |
| 136 |
else |
146 |
else |
| 137 |
log_daemon_msg "Error: worker not running for $name" |
147 |
log_daemon_msg "Error: worker not running for $name ($queue)" |
| 138 |
log_end_msg 1 |
148 |
log_end_msg 1 |
| 139 |
fi |
149 |
fi |
| 140 |
} |
150 |
} |
|
Lines 142-153
restart_worker()
Link Here
|
| 142 |
worker_status() |
152 |
worker_status() |
| 143 |
{ |
153 |
{ |
| 144 |
local name=$1 |
154 |
local name=$1 |
|
|
155 |
local queue=$2 |
| 145 |
|
156 |
|
| 146 |
if is_worker_running ${name}; then |
157 |
if is_worker_running ${name} ${queue}; then |
| 147 |
log_daemon_msg "worker running for ${name}" |
158 |
log_daemon_msg "worker running for ${name} ($queue)" |
| 148 |
log_end_msg 0 |
159 |
log_end_msg 0 |
| 149 |
else |
160 |
else |
| 150 |
log_daemon_msg "worker not running for ${name}" |
161 |
log_daemon_msg "worker not running for ${name} ($queue)" |
| 151 |
log_end_msg 3 |
162 |
log_end_msg 3 |
| 152 |
fi |
163 |
fi |
| 153 |
} |
164 |
} |
|
Lines 162-167
set_action()
Link Here
|
| 162 |
} |
173 |
} |
| 163 |
|
174 |
|
| 164 |
op="" |
175 |
op="" |
|
|
176 |
queue="default" |
| 165 |
quiet="no" |
177 |
quiet="no" |
| 166 |
|
178 |
|
| 167 |
# Read command line parameters |
179 |
# Read command line parameters |
|
Lines 185-190
while [ $# -gt 0 ]; do
Link Here
|
| 185 |
--status) |
197 |
--status) |
| 186 |
set_action "status" |
198 |
set_action "status" |
| 187 |
shift ;; |
199 |
shift ;; |
|
|
200 |
--queue) |
| 201 |
queue="$2" |
| 202 |
shift 2 ;; |
| 188 |
-*) |
203 |
-*) |
| 189 |
die "Error: invalid option switch ($1)" ;; |
204 |
die "Error: invalid option switch ($1)" ;; |
| 190 |
*) |
205 |
*) |
|
Lines 214-229
if [ $# -gt 0 ]; then
Link Here
|
| 214 |
|
229 |
|
| 215 |
case $op in |
230 |
case $op in |
| 216 |
"start") |
231 |
"start") |
| 217 |
start_worker $name |
232 |
start_worker $name $queue |
| 218 |
;; |
233 |
;; |
| 219 |
"stop") |
234 |
"stop") |
| 220 |
stop_worker $name |
235 |
stop_worker $name $queue |
| 221 |
;; |
236 |
;; |
| 222 |
"restart") |
237 |
"restart") |
| 223 |
restart_worker $name |
238 |
restart_worker $name $queue |
| 224 |
;; |
239 |
;; |
| 225 |
"status") |
240 |
"status") |
| 226 |
worker_status $name |
241 |
worker_status $name $queue |
| 227 |
esac |
242 |
esac |
| 228 |
|
243 |
|
| 229 |
else |
244 |
else |
| 230 |
- |
|
|