From d0492beacc9bae45c9ac73072c6c97621f0b1b5a Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 28 Sep 2017 15:20:04 +0200 Subject: hyiene --- develop_server.sh | 103 ------------------------------------------------------ 1 file changed, 103 deletions(-) delete mode 100755 develop_server.sh (limited to 'develop_server.sh') diff --git a/develop_server.sh b/develop_server.sh deleted file mode 100755 index 56c9cb9..0000000 --- a/develop_server.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env bash -## -# This section should match your Makefile -## -PY=python3 -PELICAN=pelican -PELICANOPTS= - -BASEDIR=$(pwd) -INPUTDIR=$BASEDIR/content -OUTPUTDIR=$BASEDIR/output -CONFFILE=$BASEDIR/pelicanconf.py - -### -# Don't change stuff below here unless you are sure -### - -SRV_PID=$BASEDIR/srv.pid -PELICAN_PID=$BASEDIR/pelican.pid - -function usage(){ - 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" - echo "you will need to edit it as well" - exit 3 -} - -function alive() { - kill -0 $1 >/dev/null 2>&1 -} - -function shut_down(){ - PID=$(cat $SRV_PID) - if [[ $? -eq 0 ]]; then - if alive $PID; then - echo "Killing pelican.server" - kill $PID - else - echo "Stale PID, deleting" - fi - rm $SRV_PID - else - echo "pelican.server PIDFile not found" - fi - - PID=$(cat $PELICAN_PID) - if [[ $? -eq 0 ]]; then - if alive $PID; then - echo "Killing Pelican" - kill $PID - else - echo "Stale PID, deleting" - fi - rm $PELICAN_PID - else - echo "Pelican PIDFile not found" - fi -} - -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 $port & - srv_pid=$! - echo $srv_pid > $SRV_PID - cd $BASEDIR - sleep 1 - if ! alive $pelican_pid ; then - echo "Pelican didn't start. Is the pelican package installed?" - return 1 - elif ! alive $srv_pid ; then - echo "pelican.server didn't start. Is there something else which uses port 8000?" - return 1 - fi - echo 'Pelican and pelican.server processes now running in background.' -} - -### -# MAIN -### -[[ ($# -eq 0) || ($# -gt 2) ]] && usage -port='' -[[ $# -eq 2 ]] && port=$2 - -if [[ $1 == "stop" ]]; then - shut_down -elif [[ $1 == "restart" ]]; then - shut_down - start_up $port -elif [[ $1 == "start" ]]; then - if ! start_up $port; then - shut_down - fi -else - usage -fi -- cgit v1.2.3 [cgit] Unable to lock slot /tmp/cgit/2d100000.lock: No such file or directory (2)