From a4706d2f256d07d9e08df18ae8ba460c07c92cca Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Tue, 7 Feb 2017 08:03:59 -0500 Subject: [PATCH] updating user, variable-izing some things --- update-sip.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/update-sip.sh b/update-sip.sh index c663828..84ea595 100755 --- a/update-sip.sh +++ b/update-sip.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2012 Georgia Public Library Service +# Copyright (C) 2012-2017 Georgia Public Library Service # Chris Sharp # # This program is free software: you can redistribute it and/or modify @@ -17,25 +17,25 @@ # along with this program. If not, see . # -# This is a script to easily access the /openils/conf/oils_sip.xml file, +# This is a script to easily access the $SIP_CONFIG 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) +EDITOR="vim" +USER="opensrf" +SIP_CONFIG="/openils/conf/oils_sip.xml" +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" +cp -v $SIP_CONFIG $SIP_CONFIG.`date +%F` +$EDITOR $SIP_CONFIG 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` + ssh $USER@$server cp -v $SIP_CONFIG $SIP_CONFIG.`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.*" + scp $SIP_CONFIG $USER@$server:$SIP_CONFIG echo "Done with $server"; done -- 2.11.0