forked from github/pelican
add port parameter to bash script
This commit is contained in:
parent
3da4c2e13e
commit
3a5db543bb
1 changed files with 10 additions and 6 deletions
|
|
@ -18,7 +18,7 @@ SRV_PID=$$BASEDIR/srv.pid
|
|||
PELICAN_PID=$$BASEDIR/pelican.pid
|
||||
|
||||
function usage(){
|
||||
echo "usage: $$0 (stop) (start) (restart)"
|
||||
echo "usage: $$0 (stop) (start) (restart) [port]"
|
||||
echo "This starts pelican in debug and reload mode and then launches"
|
||||
echo "A pelican.server to help site development. It doesn't read"
|
||||
echo "your pelican options so you edit any paths in your Makefile"
|
||||
|
|
@ -59,13 +59,14 @@ function shut_down(){
|
|||
}
|
||||
|
||||
function start_up(){
|
||||
local port=$$1
|
||||
echo "Starting up Pelican and pelican.server"
|
||||
shift
|
||||
$$PELICAN --debug --autoreload -r $$INPUTDIR -o $$OUTPUTDIR -s $$CONFFILE $$PELICANOPTS &
|
||||
pelican_pid=$$!
|
||||
echo $$pelican_pid > $$PELICAN_PID
|
||||
cd $$OUTPUTDIR
|
||||
$PY -m pelican.server &
|
||||
$PY -m pelican.server $$port &
|
||||
srv_pid=$$!
|
||||
echo $$srv_pid > $$SRV_PID
|
||||
cd $$BASEDIR
|
||||
|
|
@ -83,15 +84,18 @@ function start_up(){
|
|||
###
|
||||
# MAIN
|
||||
###
|
||||
[[ $$# -ne 1 ]] && usage
|
||||
[[ ($$# -eq 0) || ($$# -gt 2) ]] && usage
|
||||
port=''
|
||||
[[ $$# -eq 2 ]] && port=$$2
|
||||
|
||||
if [[ $$1 == "stop" ]]; then
|
||||
shut_down
|
||||
elif [[ $$1 == "restart" ]]; then
|
||||
shut_down
|
||||
start_up
|
||||
start_up $$port
|
||||
elif [[ $$1 == "start" ]]; then
|
||||
if ! start_up; then
|
||||
shut_down
|
||||
if ! start_up $$port; then
|
||||
shut_down
|
||||
fi
|
||||
else
|
||||
usage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue