Merge remote-tracking branch 'origin/new/bug_8251'
[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 # you should hard code this if you have multiple directories
28 # in your PERL5LIB
29 PERL_MODULE_DIR=$PERL5LIB
30 cd $PERL_MODULE_DIR/C4/SIP;
31 echo;
32
33 sipconfig=${1};
34 outfile=${2:-$HOME/sip.out};
35 errfile=${3:-$HOME/sip.err};
36
37 if [ $sipconfig ]; then
38         echo "Running with config file located in $sipconfig" ;
39         echo "Calling (backgrounded):";
40     echo "perl ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile";
41     perl ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile &
42
43 else
44         echo "Please specify a config file and try again."
45 fi