3 # This section should match your Makefile
6 PELICAN=${PELICAN:-pelican}
10 INPUTDIR=$BASEDIR/content
11 OUTPUTDIR=$BASEDIR/output
12 CONFFILE=$BASEDIR/pelicanconf.py
15 # Don't change stuff below here unless you are sure
18 SRV_PID=$BASEDIR/srv.pid
19 PELICAN_PID=$BASEDIR/pelican.pid
22 echo "usage: $0 (stop) (start) (restart) [port]"
23 echo "This starts Pelican in debug and reload mode and then launches"
24 echo "an HTTP server to help site development. It doesn't read"
25 echo "your Pelican settings, so if you edit any paths in your Makefile"
26 echo "you will need to edit your settings as well."
31 kill -0 $1 >/dev/null 2>&1
36 if [[ $? -eq 0 ]]; then
38 echo "Stopping HTTP server"
41 echo "Stale PID, deleting"
45 echo "HTTP server PIDFile not found"
48 PID=$(cat $PELICAN_PID)
49 if [[ $? -eq 0 ]]; then
51 echo "Killing Pelican"
54 echo "Stale PID, deleting"
58 echo "Pelican PIDFile not found"
64 echo "Starting up Pelican and HTTP server"
66 $PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS &
68 echo $pelican_pid > $PELICAN_PID
70 $PY -m pelican.server $port &
72 echo $srv_pid > $SRV_PID
75 if ! alive $pelican_pid ; then
76 echo "Pelican didn't start. Is the Pelican package installed?"
78 elif ! alive $srv_pid ; then
79 echo "The HTTP server didn't start. Is there another service using port" $port "?"
82 echo 'Pelican and HTTP server processes now running in background.'
88 [[ ($# -eq 0) || ($# -gt 2) ]] && usage
90 [[ $# -eq 2 ]] && port=$2
92 if [[ $1 == "stop" ]]; then
94 elif [[ $1 == "restart" ]]; then
97 elif [[ $1 == "start" ]]; then
98 if ! start_up $port; then