diff --git a/acqui.simple/z3950-daemon-launch.sh b/acqui.simple/z3950-daemon-launch.sh new file mode 100755 index 0000000000..0e6fab8672 --- /dev/null +++ b/acqui.simple/z3950-daemon-launch.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# Script to start Koha background Z39.50 search daemon + +# Part of the Koha Library Mgmt System - www.koha.org +# Licensed under the GPL + +#---------------------------- +# Call this script during system startup, such as from rc.local + +# Bugs/To Do: +# Needs SysV-type start/stop options + +#---------------------------- +# User ID to run the daemon as. Don't use "root" +RunAsUser=apache + +KohaDir=/usr/local/www/koha/htdocs/cgi-bin/koha/acqui.simple +export KohaDir + +#---------------------------- +if [ ! -d $KohaDir ] +then + echo ERROR: Cannot find Koha directory $KohaDir + exit 1 +fi + +KohaZ3950Shell=$KohaDir/z3950-daemon-shell.sh + +if [ ! -x $KohaZ3950Shell ] +then + echo ERROR: Cannot find Koha Z39.50 daemon launcher $KohaZ3950Shell + exit 1 +fi + +su -s /bin/sh -c '$KohaZ3950Shell &' - $RunAsUser & diff --git a/acqui.simple/z3950-daemon-shell.sh b/acqui.simple/z3950-daemon-shell.sh new file mode 100755 index 0000000000..b51710c1a3 --- /dev/null +++ b/acqui.simple/z3950-daemon-shell.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# Script to start Koha background Z39.50 search daemon + +# Part of the Koha Library Mgmt System - www.koha.org +# Licensed under the GPL + +#---------------------------- +# Do NOT run this script directly from system startup- +# Call z3950-daemon-launch.sh instead + +#---------------------------- + +KohaDir=/usr/local/www/koha/htdocs/cgi-bin/koha/acqui.simple +KohaModuleDir=/usr/local/koha/modules +LogDir=/var/log/koha + +#---------------------------- +LOGFILE=$LogDir/z3950-daemon-`date +%Y%m%d-%H%M`.log + +touch $LOGFILE +if [ ! -w $LOGFILE ] +then + echo ERROR: Cannot write to log file $LOGFILE + exit 1 +fi + +KohaZ3950Script=$KohaDir/processz3950queue +if [ ! -x $KohaZ3950Script ] +then + echo ERROR: Cannot find Koha Z39.50 daemon script $KohaZ3950Script + exit 1 +fi + +PERL5LIB=$KohaModuleDir +export PERL5LIB + +exec $KohaDir/processz3950queue >>$LOGFILE 2>&1