Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
790cf932
Commit
790cf932
authored
Dec 11, 2017
by
sim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reload celery automatically when testserver autoreloads
parent
14e25745
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
gargantext-testserver
tools/init.d/gargantext-testserver
+18
-1
No files found.
tools/init.d/gargantext-testserver
View file @
790cf932
#!/bin/sh
#!/bin/
ba
sh
### BEGIN INIT INFO
# Provides: gargantext-testserver
...
...
@@ -19,6 +19,7 @@ DESC=gargantext-testserver
STOP_SCHEDULE
=
"
${
STOP_SCHEDULE
:-
INT
/5/KILL/5
}
"
BASH
=
/bin/bash
CELERY_INIT
=
$(
dirname
$0
)
/gargantext-celery
GARGANTEXT_CONF
=
$(
realpath
${
GARGANTEXT_CONF
:-
gargantext
.ini
})
DAEMON_OPTS
=
"
$PWD
/manage.py runserver"
...
...
@@ -32,6 +33,16 @@ test -x "$DAEMON" || exit 0
PID
=
$(
grep
-oP
'^\s*TESTSERVER_PIDFILE\s*=\s*\K.+'
$GARGANTEXT_CONF
|
tail
-1
)
PID
=
${
PID
:-
/tmp/gargantext_testserver.pid
}
reload_celery_when_needed
()
{
[
-s
"
$PID
"
]
&&
PPID
=
$(
cat
$PID
)
&&
CHILD
=
$(
pgrep
-P
$PPID
)
[
-n
"
$PPID
"
-a
-n
"
$CHILD
"
]
&&
\
((
while
kill
-0
$CHILD
;
do
sleep
1
;
done
)
&&
\
kill
-0
$PPID
&&
\
$CELERY_INIT
status
&&
\
$CELERY_INIT
restart
)
>
/dev/null 2>&1
kill
-0
$PPID
>
/dev/null 2>&1
&&
reload_celery_when_needed
}
start
()
{
# Start the daemon/service
#
...
...
@@ -53,6 +64,12 @@ start() {
ERROR
=
$(
tail
-1
$ERROR_LOG
)
start-stop-daemon
--status
--pidfile
$PID
--exec
$DAEMON
>
/dev/null
\
||
(
log_progress_msg
"[
$ERROR
]"
&&
return
2
)
# Wait for a restart in the background and reload celery if needed. We need
# to export function and exec a new bash with nohup, otherwise current
# process would be attached to current terminal.
export
-f
reload_celery_when_needed
nohup
$BASH
-c
reload_celery_when_needed
>
/dev/null 2>&1 &
}
test_config
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment