From 082021be71facdb23ceb00fdf8ea56dfbe1c3bc5 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Fri, 14 Dec 2012 09:54:10 -0500 Subject: [PATCH] adding rudimentary sip updating script --- update-sip.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 update-sip.sh diff --git a/update-sip.sh b/update-sip.sh new file mode 100755 index 0000000..c663828 --- /dev/null +++ b/update-sip.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Copyright (C) 2012 Georgia Public Library Service +# Chris Sharp +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# This is a script to easily access the /openils/conf/oils_sip.xml file, +# add an account, and copy it over to sip02. For this to work smoothly, +# you will want to set up an ssh key between this server and the "OTHER_SIP" +# servers. + +EDITOR=vim +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) + +echo "Creating backup of SIP configuration" +cp -v /openils/conf/oils_sip.xml /openils/conf/oils_sip.xml.`date +%F` +su - opensrf -c "$EDITOR /openils/conf/oils_sip.xml" +for server in $OTHER_SIP; + do + # back up the existing conf file + echo "Creating backup of configuration on $server" + ssh root@$server cp -v /openils/conf/oils_sip.xml /openils/conf/oils_sip.xml.`date +%F` + echo "Copying new configuration to $server" + scp /openils/conf/oils_sip.xml root@$server:/openils/conf/oils_sip.xml + echo "Restoring file ownership to opensrf on $server" + ssh root@$server "chown -v opensrf:opensrf /openils/conf/oils_sip.*" + echo "Done with $server"; +done -- 2.11.0