31 lines
968 B
Bash
Executable File
31 lines
968 B
Bash
Executable File
#!/bin/sh
|
|
#Application options
|
|
INVOKER_OPTS=""
|
|
SERVER_OPTS="-D --workers 2"
|
|
APP_OPTS=""
|
|
|
|
#Defaults
|
|
INVOKER="plackup"
|
|
SERVER="Starman"
|
|
#Paths
|
|
SOCK_PATH="$BASE/$APP/.sock"
|
|
PID_PATH="$BASE/${APP}.pid"
|
|
BIN_PATH="$BASE/$APP/bin/app.pl"
|
|
|
|
#Standard startup script
|
|
[ -z "$BASE$APP" ] && exit 1
|
|
#p5env setup
|
|
PATH="$BASE/perl5/bin${PATH+:}${PATH}"; export PATH;
|
|
PERL5LIB="$BASE/perl5/lib/perl5${PERL5LIB+:}${PERL5LIB}"; export PERL5LIB;
|
|
PERL_LOCAL_LIB_ROOT="$BASE/perl5${PERL_LOCAL_LIB_ROOT+:}${PERL_LOCAL_LIB_ROOT}"; export PERL_LOCAL_LIB_ROOT;
|
|
PERL_MB_OPT="--install_base \"$BASE/perl5\""; export PERL_MB_OPT;
|
|
PERL_MM_OPT="INSTALL_BASE=$BASE/perl5"; export PERL_MM_OPT;
|
|
|
|
INVOKER_OPTS="$INVOKER_OPTS -s $SERVER"
|
|
SERVER_OPTS="$SERVER_OPTS -S $SOCK_PATH --pid $PID_PATH $APP_PATH"
|
|
APP_OPTS="$APP_OPTS"
|
|
|
|
pkill -F $BASE/${APP}.pid 2>/dev/null
|
|
while true;do pkill -0 -F $BASE/${APP}.pid 2>/dev/null || break; sleep 1; done
|
|
cd $BASE/$APP
|
|
$INVOKER $INVOKER_OPTS $SERVER_OPTS $APP_OPTS |