creating an edit/copy option
authorChris Sharp <csharp@georgialibraries.org>
Fri, 24 May 2013 12:02:39 +0000 (08:02 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Fri, 24 May 2013 12:02:39 +0000 (08:02 -0400)
update-libips.sh

index a7d720c..e4ab67c 100755 (executable)
@@ -20,6 +20,7 @@
 OSRF_CONF_DIR="/openils/conf"
 LIB_IPS_TXT="$OSRF_CONF_DIR/lib_ips.txt"
 BRICK_HEADS="6" # number of brick heads you have - script assumes you're running on brick01-head
+EDITOR="/usr/bin/editor"
 
 [[ $(whoami) != "opensrf" ]] && echo "Must be opensrf user to run this utility." && exit
 
@@ -79,18 +80,35 @@ for i in `seq 2 $BRICK_HEADS`; do
 done;
 }
 
+EditCopy () {
+$EDITOR $LIB_IPS_TXT
+read -p "Would you like to copy the file to the other brick heads? (y/n)" COPYFILE
+if [ "$COPYFILE" = "y" ]; then
+        CopyFile
+elif [ "$COPYFILE" = "n" ]; then
+        echo "Not copying file."
+        exit;
+else 
+       echo "No valid response received.  Not copying file."
+fi
+}
+
+
 echo "This program allows you to query and/or update the Evergreen Library IP redirection file on each of the application bricks."
 echo
 echo "What would you like to do?"
 echo
 echo "[1] Query the lib_ips.txt file by library name or IP address"
 echo "[2] Update the file with a new entry"
+echo "[3] Manually edit, then optionally copy the file to the other brick heads"
 echo
 read -p "Please choose option 1 or 2: " RESPONSE
 if [ "$RESPONSE" = "1" ]; then
        QueryFile
 elif [ "$RESPONSE" = "2" ]; then
        UpdateFile && echo "The file is updated" && CopyFile
+elif [ "$RESPONSE" = "3" ]; then
+       EditCopy
 else
        echo "No valid response received.  Aborting."
        exit;