Bug 7238 : Shifting SIPconfig.xml to the etc dir and the scripts to misc/bin
[koha.git] / misc / bin / sip_run.sh
1 #!/bin/bash
2
3 # A sample script for starting SIP.  
4 # You probably want to specify new log destinations.
5 #
6 # Takes 3 optional arguments:
7 # ~ SIPconfig.xml file to use
8 # ~ file for STDOUT, default ~/sip.out
9 # ~ file for STDERR, default ~/sip.err
10 #
11 # The STDOUT and STDERR files are only for the SIPServer process itself.
12 # Actual SIP communication and transaction logs are handled by Syslog.
13 #
14 # Examples:
15 #   sip_run.sh /path/to/SIPconfig.xml
16 #   sip_run.sh ~/my_sip/SIPconfig.xml sip_out.log sip_err.log
17
18
19 for x in HOME PERL5LIB KOHA_CONF ; do
20         echo $x=${!x}
21         if [ -z ${!x} ] ; then 
22                 echo ERROR: $x not defined;
23                 exit 1;
24         fi;
25 done;
26 unset x;
27 cd $PERL5LIB/C4/SIP;
28 echo;
29
30 sipconfig=${1};
31 outfile=${2:-$HOME/sip.out};
32 errfile=${3:-$HOME/sip.err};
33
34 if [ $sipconfig ]; then
35         echo "Running with config file located in $sipconfig" ;
36         echo "Calling (backgrounded):";
37         echo "perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile";
38         perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile &
39
40 else
41         echo "Please specify a config file and try again."
42 fi