]> git.evergreen-ils.org Git - contrib/pines.git/blob - update-sip.sh
add local git tar script
[contrib/pines.git] / update-sip.sh
1 #!/bin/bash
2
3 # Copyright (C) 2012-2017 Georgia Public Library Service
4 # Chris Sharp <csharp@georgialibraries.org>
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 3 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
20 # This is a script to easily access the $SIP_CONFIG file,
21 # add an account, and copy it over to sip02. For this to work smoothly, 
22 # you will want to set up an ssh key between this server and the "OTHER_SIP"
23 # servers.
24
25 EDITOR="vim"
26 USER="opensrf"
27 SIP_CONFIG="/openils/conf/oils_sip.xml"
28 OTHER_SIP="sip02" # list hostnames (as defined in /etc/hosts) to which the altered file needs to be copied (i.e., your other SIP servers)
29
30 echo "Creating backup of SIP configuration"
31 cp -v $SIP_CONFIG $SIP_CONFIG.`date +%F`
32 $EDITOR $SIP_CONFIG
33 for server in $OTHER_SIP;
34         do 
35                 # back up the existing conf file
36                 echo "Creating backup of configuration on $server"
37                 ssh $USER@$server cp -v $SIP_CONFIG $SIP_CONFIG.`date +%F`
38                 echo "Copying new configuration to $server"
39                 scp $SIP_CONFIG $USER@$server:$SIP_CONFIG
40                 echo "Done with $server";
41 done