Archived
1
0
Fork 0
This repository has been archived on 2021-10-08. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
ACU/commands/manage-server.sh
2013-09-19 04:52:29 +02:00

59 lines
961 B
Bash
Executable file

#! /bin/bash
cd $(dirname "$0")
WKS_LIST="apl"
SRV_LIST="moore noyce hamano cpp"
ACTIONS="start stop restart update"
LOG=`mktemp`
for ACT in $ACTIONS
do
if [ -n "$1" ] && [ "$1" == "$ACT" ]
then
ACTION="$ACT"
break
fi
done
if [ -z "$ACTION" ]
then
echo "Usage: $0 [$ACTIONS]"
fi
FAIL=0
for SRV in $SRV_LIST
do
echo -e "\e[1;34m>>>\e[0m $ACTION on $SRV"
if [ "$ACTION" == "update" ]
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
echo
done
for WKS in $WKS_LIST
do
echo -e "\e[1;34m>>>\e[0m $ACTION on $WKS"
if [ "$ACTION" == "update" ]
then
ssh root@$SRV "make -C liblerdorf update upgrade"
fi
echo
done
cat "$LOG"
exit $FAIL