From ee204b6686de77ad273d7098800a72cff1928b3c Mon Sep 17 00:00:00 2001 From: Matthew Connelly Date: Sun, 15 Nov 2015 23:32:35 +0000 Subject: [PATCH] more start script and hook refactoring --- .githooks/post-receive | 9 +++++++-- start | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.githooks/post-receive b/.githooks/post-receive index 61db082..67d0205 100755 --- a/.githooks/post-receive +++ b/.githooks/post-receive @@ -1,4 +1,9 @@ #!/bin/sh cat > /dev/null -git --git-dir /home/sites/blogalba/.git --work-tree /home/sites/blogalba pull -[ ! -z "$(find /home/sites/blogalba -type d -name .git -prune -o -type f -mmin -1 -print|egrep '(p(ost|age)s/|blogalba$)')" ] && echo "Restarting blogalba" && /home/sites/blogalba/scripts/start +BASE=/usr/home/sites; export BASE; APP=blogalba; export APP +START_OPTS="--workers 1"; export START_OPTS +cd $BASE/$APP; git pull; cd - +cd $BASE/$APP.mirror.git; git pull; git push; cd - +#git --git-dir $BASE/$APP/.git --work-tree $BASE/$APP pull +[ ! -z "$(find $BASE/$APP -type d -name .git -prune -o -type f -mmin -1 -print|egrep '(p(ost|age)s/|lib$)')" ] || exit +echo "Restarting $APP"; $BASE/$APP/start \ No newline at end of file diff --git a/start b/start index 3338410..f080ca0 100644 --- a/start +++ b/start @@ -1,5 +1,5 @@ #!/bin/sh -[ -z "$BASE" ] && BASE=/usr/home/sites +[ -z "$BASE$APP" ] && exit 1 #p5env setup PATH="$BASE/perl5/bin${PATH+:}${PATH}"; export PATH; PERL5LIB="$BASE/perl5/lib/perl5${PERL5LIB+:}${PERL5LIB}"; export PERL5LIB; @@ -9,4 +9,4 @@ PERL_MM_OPT="INSTALL_BASE=$BASE/perl5"; export PERL_MM_OPT; pkill -F $BASE/${APP}.pid 2>/dev/null for((;;));do pkill -0 -F $BASE/${APP}.pid 2>/dev/null || break; sleep 1; done -plackup -s Starman -D -S $BASE/$APP/.sock $BASE/$APP/app.psgi --pid $BASE/${APP}.pid --workers 1 +plackup -s Starman -D -S $BASE/$APP/.sock $BASE/$APP/app.psgi --pid $BASE/${APP}.pid $START_OPTS