Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Maintenance - Mise à jour mensuelle Lundi 6 Février entre 7h00 et 9h00
Open sidebar
genotoul-bioinfo
D-GENIES
Commits
14bd68ea
Commit
14bd68ea
authored
Dec 18, 2017
by
Floreal Cabanettes
Browse files
Add possibility to disable crons launching [for debug only] + add tests on launch_server.sh
parent
7ae3b7da
Changes
2
Hide whitespace changes
Inline
Side-by-side
bin/launch_server.sh
View file @
14bd68ea
...
...
@@ -6,6 +6,7 @@ SCRIPTPATH=`dirname ${SCRIPT}`
DEBUG
=
False
LOCAL
=
False
PORT
=
5000
CRONS
=
True
function
usage
()
{
...
...
@@ -16,9 +17,26 @@ function usage()
echo
-e
"
\t
--debug=
${
DEBUG
}
\t
True to run in debug mode"
echo
-e
"
\t
--local=
${
LOCAL
}
\t
True to make the website accessible only on the hosting PC"
echo
-e
"
\t
--port=
${
PORT
}
\t
Port number onto run the server"
echo
-e
"
\t
--crons=
${
CRONS
}
\t
Start crons (disable it only for tests)"
echo
""
}
function
is_bool
()
{
if
[
"
$1
"
!=
"True"
]
&&
[
"
$1
"
!=
"False"
]
;
then
echo
"
$2
: error:
$1
is not 'True' or 'False': invalid parameter"
exit
1
fi
}
function
is_number
()
{
re
=
'^[0-9]+$'
if
!
[[
$1
=
~
$re
]]
;
then
echo
"
$2
: error:
$1
is not a number: invalid parameter"
;
exit
1
fi
}
while
[
"
$1
"
!=
""
]
;
do
PARAM
=
`
echo
$1
|
awk
-F
=
'{print $1}'
`
VALUE
=
`
echo
$1
|
awk
-F
=
'{print $2}'
`
...
...
@@ -28,14 +46,21 @@ while [ "$1" != "" ]; do
exit
;;
--debug
)
is_bool
${
VALUE
}
"--debug"
DEBUG
=
${
VALUE
}
;;
--local
)
is_bool
${
VALUE
}
"--local"
LOCAL
=
${
VALUE
}
;;
--port
)
is_number
${
VALUE
}
"--port"
PORT
=
${
VALUE
}
;;
--crons
)
is_bool
${
VALUE
}
"--crons"
CRONS
=
${
VALUE
}
;;
*
)
echo
"ERROR: unknown parameter
\"
${
PARAM
}
\"
"
usage
...
...
@@ -56,4 +81,4 @@ if [ "$LOCAL" == "True" ]; then
host
=
"127.0.0.1"
fi
FLASK_DEBUG
=
${
debug
}
FLASK_APP
=
${
SCRIPTPATH
}
/../srv/main.py flask run
--host
=
${
host
}
--port
=
${
PORT
}
CRONS
=
${
CRONS
}
FLASK_DEBUG
=
${
debug
}
FLASK_APP
=
${
SCRIPTPATH
}
/../srv/main.py flask run
--host
=
${
host
}
--port
=
${
PORT
}
srv/main.py
View file @
14bd68ea
...
...
@@ -46,8 +46,10 @@ mailer = Mailer(app)
app_data
=
config_reader
.
app_data
# Crons:
crons
=
Crons
(
app_folder
)
crons
.
start_all
()
if
os
.
environ
[
'CRONS'
]
==
"True"
:
print
(
"Starting crons..."
)
crons
=
Crons
(
app_folder
)
crons
.
start_all
()
@
app
.
context_processor
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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