mild improvements to startup script

This commit is contained in:
Maff 2018-12-29 19:38:39 +00:00
parent 603c3ded5e
commit 12b2b7f02e
2 changed files with 17 additions and 3 deletions

View File

@ -19,7 +19,7 @@ engines:
name: colourful words and phrases name: colourful words and phrases
tagline: techy tangents and general life chatter from a tired sysadmin. tagline: techy tangents and general life chatter from a tired sysadmin.
author: Maff author: Maff
about: A dorky dude who spends too much time with perl. about: A dorky person who spends too much time with computers.
keywords: "sysadmin,unix,bsd,freebsd,linux,software,web,developer,perl,bash,shell,gentoo,maff,matthew,connelly,dundee,scotland,furry,blog" keywords: "sysadmin,unix,bsd,freebsd,linux,software,web,developer,perl,bash,shell,gentoo,maff,matthew,connelly,dundee,scotland,furry,blog"
blog_prepend: wrote blog_prepend: wrote
conf: conf:

18
start
View File

@ -1,6 +1,16 @@
#!/bin/sh #!/bin/sh
#Application options #Application options
START_OPTS="--workers 1" 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 #Standard startup script
[ -z "$BASE$APP" ] && exit 1 [ -z "$BASE$APP" ] && exit 1
@ -11,7 +21,11 @@ PERL_LOCAL_LIB_ROOT="$BASE/perl5${PERL_LOCAL_LIB_ROOT+:}${PERL_LOCAL_LIB_ROOT}";
PERL_MB_OPT="--install_base \"$BASE/perl5\""; export PERL_MB_OPT; PERL_MB_OPT="--install_base \"$BASE/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=$BASE/perl5"; export PERL_MM_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 pkill -F $BASE/${APP}.pid 2>/dev/null
while true;do pkill -0 -F $BASE/${APP}.pid 2>/dev/null || break; sleep 1; done while true;do pkill -0 -F $BASE/${APP}.pid 2>/dev/null || break; sleep 1; done
cd $BASE/$APP cd $BASE/$APP
plackup -s Starman -D -S $BASE/$APP/.sock $BASE/$APP/bin/app.pl --pid $BASE/${APP}.pid $START_OPTS $INVOKER $INVOKER_OPTS $SERVER_OPTS $APP_OPTS