Bug 16573: fix linkid value on marc_subfield_structure
[koha.git] / misc / plack / plackup.sh
blob2c7f5990852107408c10b096c24cdf6df8277abc
1 #!/bin/sh -e
3 # This is plack startup script for Koha
5 # ./plackup.sh [site] [intranet]
7 site=$1
8 test ! -z "$site" && shift || ( echo "usage: $0 [site] [i[tranet]]" ; exit 1 )
10 # extract useful paths from koha-conf.xml
11 export KOHA_CONF=/etc/koha/sites/$site/koha-conf.xml
12 export LOGDIR="$( sudo -u $site-koha xmlstarlet sel -t -v 'yazgfs/config/logdir' $KOHA_CONF )"
13 export INTRANETDIR="$( sudo -u $site-koha xmlstarlet sel -t -v 'yazgfs/config/intranetdir' $KOHA_CONF )"
14 export OPACDIR="$( sudo -u $site-koha xmlstarlet sel -t -v 'yazgfs/config/opacdir' $KOHA_CONF | sed 's,/cgi-bin/opac,,' )"
16 dir=`dirname $0`
18 # enable memcache - it's safe even on installation which don't have it
19 # since Koha has check on C4::Context
20 #export MEMCACHED_SERVERS=localhost:11211
21 # pass site name as namespace to perl code
22 export MEMCACHED_NAMESPACE=$site
23 #export MEMCACHED_DEBUG=1
25 if [ ! -e "$INTRANETDIR/C4" ] ; then
26 echo "intranetdir in $KOHA_CONF doesn't point to Koha git checkout"
27 exit 1
30 if [ -z "$1" ] ; then # type anything after site name for intranet!
31 INTRANET=0
32 PORT=5000
33 else
34 INTRANET=1
35 PORT=5001
36 shift # pass rest of arguments to plackup
38 export INTRANET # pass to plack
40 # uncomment to enable logging
41 #opt="$opt --access-log $LOGDIR/opac-access.log --error-log $LOGDIR/opac-error.log"
43 # --max-requests 50 decreased from 1000 to keep memory usage sane
44 # --workers 4 number of cores on machine
45 #test "$INTRANET" != 1 && \ # don't use Starman for intranet
46 opt="$opt --server Starman -M FindBin --max-requests 50 --workers 4"
48 # -E deployment turn off access log on STDOUT
49 opt="$opt -E deployment"
51 # comment out reload in production!
52 opt="$opt --reload -R $INTRANETDIR/C4 -R $INTRANETDIR/Koha"
54 sudo -E -u $site-koha plackup --port $PORT -I $INTRANETDIR -I $INTRANETDIR/installer $opt $* $dir/koha.psgi