Skip to content

Commit

Permalink
seahub.sh added an "python-env" to set up env for debugging.
Browse files Browse the repository at this point in the history
  • Loading branch information
lins05 committed May 2, 2017
1 parent 05d2f19 commit 0b300d6
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion scripts/seahub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function usage () {

# Check args
if [[ $1 != "start" && $1 != "stop" && $1 != "restart" \
&& $1 != "start-fastcgi" && $1 != "restart-fastcgi" && $1 != "clearsessions" ]]; then
&& $1 != "start-fastcgi" && $1 != "restart-fastcgi" && $1 != "clearsessions" && $1 != "python-env" ]]; then
usage;
exit 1;
fi
Expand Down Expand Up @@ -120,6 +120,8 @@ elif [[ $1 == "stop" && $# == 1 ]]; then
dummy=dummy
elif [[ $1 == "clearsessions" && $# == 1 ]]; then
dummy=dummy
elif [[ $1 == "python-env" ]]; then
dummy=dummy
else
usage;
exit 1
Expand Down Expand Up @@ -245,6 +247,24 @@ function check_init_admin() {
fi
}

function run_python_env() {
local pyexec

prepare_env;

if which ipython 2>/dev/null; then
pyexec=ipython
else
pyexec=$PYTHON
fi

if [[ $# -eq 0 ]]; then
$pyexec "$@"
else
"$@"
fi
}

case $1 in
"start" )
start_seahub;
Expand All @@ -265,6 +285,10 @@ case $1 in
sleep 2
start_seahub_fastcgi
;;
"python-env")
shift
run_python_env "$@"
;;
"clearsessions" )
clear_sessions
;;
Expand Down

0 comments on commit 0b300d6

Please sign in to comment.