]> git.evergreen-ils.org Git - working/SIPServer.git/blob - sip_run.sh
LP1579144: Give Sip/MsgType.pm a copy of to_bool() from ILS.pm
[working/SIPServer.git] / sip_run.sh
1 #!/bin/bash
2 #
3 # Copyright (C) 2010 Equinox Software, Inc.
4 # Author: Joe Atzberger
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 # A sample script for starting SIP.  
20 # You probably want to specify new log destinations.
21 #
22 # Takes 3 optional arguments:
23 # ~ SIPconfig.xml file to use
24 # ~ file for STDOUT, default ~/sip.out
25 # ~ file for STDERR, default ~/sip.err
26 #
27 # The STDOUT and STDERR files are only for the SIPServer process itself.
28 # Actual SIP communication and transaction logs are handled by Syslog.
29 #
30 # Examples:
31 #   sip_run.sh /path/to/SIPconfig.xml
32 #   sip_run.sh ~/my_sip/SIPconfig.xml sip_out.log sip_err.log
33
34
35 for x in HOME PERL5LIB; do
36         echo $x=${!x}
37         if [ -z ${!x} ] ; then 
38                 echo ERROR: $x not defined;
39                 exit 1;
40         fi;
41 done;
42 unset x;
43 # cd $PERL5LIB/C4/SIP;
44 echo;
45 echo Running from `pwd`;
46
47 sipserver='./SIPServer.pm';
48 sipconfig=${1:-`pwd`/SIPconfig.xml};
49 outfile=${2:-$HOME/sip.out};
50 errfile=${3:-$HOME/sip.err};
51
52 if [ ! -r $sipconfig ] ; then
53     echo "ERROR: Required SIP Configuration file not found at '$sipconfig'" >&2;
54     exit 1;
55 fi
56 if [ ! -r $sipserver ] ; then
57     echo "ERROR: Target SIPServer not found at '$sipserver'" >&2;
58     exit 1;
59 fi
60 echo "Calling (backgrounded):";
61 echo "perl -I./ $sipserver $sipconfig >>$outfile 2>>$errfile";
62 perl -I./ $sipserver $sipconfig >>$outfile 2>>$errfile &