From aa877363fd5d7f4171d496684897340a49031937 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Mon, 27 Jul 2015 13:06:30 -0400 Subject: [PATCH] adding script to restart services on bricks --- restart-services.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 restart-services.sh diff --git a/restart-services.sh b/restart-services.sh new file mode 100644 index 0000000..efe6fb8 --- /dev/null +++ b/restart-services.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# (C) Copyright 2015 Georgia Public Library Service +# Chris Sharp +# +# Convenience script for restarting services across multiple bricks. +# + + +Usage (){ + echo "USAGE: $0 " + echo "Valid commands: apache, opensrf, autogen." + exit 1; +} + +HEADS="brick02-head brick03-head brick04-head brick05-head brick06-head" +case $1 in +*help) Usage ;; +"") Usage ;; +apache) COMMAND="/etc/init.d/apache2 restart" ;; +opensrf) COMMAND="/etc/init.d/opensrf restart" ;; +autogen) COMMAND="/etc/init.d/opensrf autogen" ;; +*) Usage ;; +esac + +# start with ourselves +#echo "`hostname`:" +#bash -ic detach && $COMMAND && sleep 2 && bash -ic attach +for head in $HEADS; do + echo "$head:" + ssh $head "bash -ic detach && $COMMAND && sleep 2 && bash -ic attach" +done -- 2.11.0