Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Working (ugly) code

  • Loading branch information...
commit 3951f4d331d1ca1b2bc5256010ae4d1c674f08f8 1 parent 733da56
Andrew Rodland authored
Showing with 14 additions and 6 deletions.
  1. +14 −6 cat-psgi-init
View
20 cat-psgi-init
@@ -17,7 +17,10 @@
APPNAME=MyApp
APPDIR=/home/myapp/MyApp
UNIXNAME=$(echo $APPNAME | perl -pe 's/::/_/;$_=lc')
-PROCS=5
+PLACKUP="plackup"
+PSGI="$APPDIR/script/$UNIXNAME.psgi"
+PLACK_SERVER=Starman
+PLACK_SERVER_OPTS="--workers 5 --preload-app"
SOCKET=127.0.0.1:3001
# Leave these unset and we won't try to setuid/setgid.
USER=myapp
@@ -45,21 +48,24 @@ fi
PIDFILE=$PIDDIR/$UNIXNAME${PIDSUFFIX:+"-$PIDSUFFIX"}.pid
if [ -n "$LOCALLIB" ] ; then
- eval `perl -I"$LOCALLIB" -Mlocal::lib="$LOCALLIB"`
+ eval `perl -I"$LOCALLIB/lib/perl5" -Mlocal::lib="$LOCALLIB"`
fi
+PERL5LIB="$APPDIR/lib"${PERL5LIB:+":"}$PERL5LIB
+export PERL5LIB
+
check_running() {
[ -s $PIDFILE ] && kill -0 $(cat $PIDFILE) >/dev/null 2>&1
}
check_compile() {
if [ -n "$USER" ] ; then
- if su $USER -c "cd $APPDIR ; perl -Ilib -M$APPNAME -ce1" ; then
+ if su $USER -c "cd $APPDIR ; perl -Ilib -M$APPNAME -c $PSGI" ; then
return 0
fi
return 1
else
- if ( cd $APPDIR ; perl -Ilib -M$APPNAME -ce1 ) ; then
+ if ( cd $APPDIR ; perl -Ilib -M$APPNAME -c $PSGI ) ; then
return 0
fi
return 1
@@ -69,8 +75,10 @@ check_compile() {
_start() {
start-stop-daemon --start --quiet --pidfile $PIDFILE --chdir $APPDIR \
${USER:+"--chuid"} $USER ${GROUP:+"--group"} $GROUP --background \
- --startas $APPDIR/script/${UNIXNAME}_fastcgi.pl -- \
- -n $PROCS -l $SOCKET -p $PIDFILE
+ --startas "$PLACKUP" -- \
+ -MFile::Pid::Quick="$PIDFILE" \
+ --listen "$SOCKET" ${PLACK_SERVER:+"-s"} $PLACK_SERVER $PLACK_SERVER_OPTS \
+ -- "$PSGI"
for i in 1 2 3 4 5 6 7 8 9 10; do
sleep 1
Please sign in to comment.
Something went wrong with that request. Please try again.