New arg to update all servers
This commit is contained in:
parent
7b2a4185c9
commit
e44db62e10
2 changed files with 28 additions and 6 deletions
30
commands/manage-server.sh
Normal file → Executable file
30
commands/manage-server.sh
Normal file → Executable file
|
@ -1,10 +1,12 @@
|
||||||
#! /bin/sh
|
#! /bin/bash
|
||||||
|
|
||||||
cd $(dirname "$0")
|
cd $(dirname "$0")
|
||||||
|
|
||||||
SRV_LIST="moore noyce hamano cpp"
|
SRV_LIST="moore noyce hamano cpp"
|
||||||
|
|
||||||
ACTIONS="start stop restart"
|
ACTIONS="start stop restart update"
|
||||||
|
|
||||||
|
LOG=`mktemp`
|
||||||
|
|
||||||
for ACT in $ACTIONS
|
for ACT in $ACTIONS
|
||||||
do
|
do
|
||||||
|
@ -20,7 +22,27 @@ then
|
||||||
echo "Usage: $0 [$ACTIONS]"
|
echo "Usage: $0 [$ACTIONS]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
FAIL=0
|
||||||
for SRV in $SRV_LIST
|
for SRV in $SRV_LIST
|
||||||
do
|
do
|
||||||
ssh root@$SRV ~/liblerdorf/process/launch.sh "$ACTION"
|
if [ "$ACTION" == "update" ]
|
||||||
done
|
then
|
||||||
|
ssh root@$SRV "make -C liblerdorf update upgrade"
|
||||||
|
else
|
||||||
|
ssh root@$SRV '~'/liblerdorf/process/launch.sh "$ACTION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
echo -e "\e[1;32m>>>\e[0m $ACTION success on $SRV" | tee -a "$LOG"
|
||||||
|
else
|
||||||
|
echo -e "\e[1;31m>>>\e[0m $ACTION fails on $SRV" | tee -a "$LOG"
|
||||||
|
FAIL=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
cat "$LOG"
|
||||||
|
|
||||||
|
exit $FAIL
|
|
@ -42,7 +42,7 @@ else
|
||||||
HOSTNAME="$2"
|
HOSTNAME="$2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ACTION" == "stop" ] || [ "$ACTION" == "restart" ]
|
if [ "$ACTION" = "stop" ] || [ "$ACTION" = "restart" ]
|
||||||
then
|
then
|
||||||
# Kill old liblersorf screen sessions
|
# Kill old liblersorf screen sessions
|
||||||
$SU -c "$SCREEN -ls" intradmin | $GREP '[0-9]+\.lerdorf_[a-zA-Z0-9_-]+' |
|
$SU -c "$SCREEN -ls" intradmin | $GREP '[0-9]+\.lerdorf_[a-zA-Z0-9_-]+' |
|
||||||
|
@ -54,7 +54,7 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$ACTION" == "start" ] || [ "$ACTION" == "restart" ]
|
if [ "$ACTION" = "start" ] || [ "$ACTION" = "restart" ]
|
||||||
then
|
then
|
||||||
case $HOSTNAME in
|
case $HOSTNAME in
|
||||||
|
|
||||||
|
|
Reference in a new issue