From 675595367a23eeabf66ed4dacedd33e1d15a941a Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Fri, 24 May 2013 08:02:39 -0400 Subject: [PATCH] creating an edit/copy option --- update-libips.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/update-libips.sh b/update-libips.sh index a7d720c..e4ab67c 100755 --- a/update-libips.sh +++ b/update-libips.sh @@ -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; -- 2.11.0