Created
June 9, 2016 15:07
-
-
Save alexs77/aeab0f4ca41088657b096d0ae3350a18 to your computer and use it in GitHub Desktop.
Start/Stop/Status Zimbra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
start () { | |
echo "Starte Zimbra $1 Umgebung..." | |
for h in zcs-ds7-$1; do | |
if ping -c1 $h > /dev/null 2>&1; then | |
echo "$h" | |
ssh -l zimbra "$h" "zmcontrol start" | |
echo | |
else | |
echo "$h nicht erreichbar?!?" | |
fi | |
done | |
for h in zcs-ds6-$1; do | |
if ping -c1 $h > /dev/null 2>&1; then | |
echo "$h" | |
ssh -l zimbra "$h" "zmcontrol start" | |
echo | |
else | |
echo "$h nicht erreichbar?!?" | |
fi | |
done | |
for h in zcs-{{b,f}e{5,6},ff3}-$1; do | |
if ping -c1 $h > /dev/null 2>&1; then | |
echo "$h" | |
ssh -l zimbra "$h" "zmcontrol start" & | |
echo | |
else | |
echo "$h nicht erreichbar?!?" | |
fi | |
done; wait | |
echo "...ageschlossen" | |
} | |
stop () { | |
echo "Stoppe Zimbra $1 Umgebung..." | |
for h in zcs-{{b,f}e{5,6},ff3,ds6}-$1; do | |
if ping -c1 $h > /dev/null 2>&1; then | |
echo "$h" | |
ssh -l zimbra "$h" "zmcontrol stop" & | |
echo | |
else | |
echo "$h nicht erreichbar?!?" | |
fi | |
done; wait | |
for h in zcs-ds7-$1; do | |
if ping -c1 $h > /dev/null 2>&1; then | |
echo "$h" | |
ssh -l zimbra "$h" "zmcontrol stop" | |
echo | |
else | |
echo "$h nicht erreichbar?!?" | |
fi | |
done | |
echo "...abgeschlossen" | |
} | |
restart () { | |
echo "Restart Zimbra $1 Umgebung" | |
for h in zcs-ds7-$1; do | |
if ping -c1 $h > /dev/null 2>&1; then | |
echo "$h" | |
ssh -l zimbra "$h" "zmcontrol stop; zmcontrol start" | |
echo | |
else | |
echo "$h nicht erreichbar?!?" | |
fi | |
done | |
for h in zcs-{ds6,{b,f}e{5,6},ff3}-$1; do | |
if ping -c1 $h > /dev/null 2>&1; then | |
echo "$h" | |
ssh -l zimbra "$h" "zmcontrol stop; zmcontrol start" & | |
echo | |
else | |
echo "$h nicht erreichbar?!?" | |
fi | |
done; wait | |
echo "...abgeschlossen" | |
} | |
status () { | |
echo "Status der Zimbra $1 Umgebung..." | |
for h in zcs-{ds{7,6},{b,f}e{5,6},ff3}-$1; do | |
if ping -c1 $h > /dev/null 2>&1; then | |
echo "$h" | |
ssh -l zimbra "$h" "zmcontrol status" | |
echo | |
else | |
echo "$h nicht erreichbar?!?" | |
fi | |
done | |
echo "...abgeschlossen" | |
} | |
aufruf () { | |
echo "Aufruf: $0 [-1|-0|-s|-r] [-P]" | |
echo "" | |
echo " -1: Starte die Zimba Test Umgebung" | |
echo " -0: Stoppe die Zimbra Test Umgebung" | |
echo " -s: Status der Zimbra Test Umgebung" | |
echo " -r: Restart der Zimbra Test Umgebung" | |
echo " -P: Verwende Zimbra PROD Umgebung, anstelle von Test" | |
} | |
action="unbekannt" | |
systems="ip" | |
while getopts "10srP" options; do | |
case $options in | |
1) | |
action="start" | |
;; | |
0) | |
action="stop" | |
;; | |
r) | |
action="restart" | |
;; | |
s) | |
action="status" | |
;; | |
P) | |
systems="prod" | |
;; | |
\?) | |
aufruf | |
exit 1 | |
;; | |
esac | |
done | |
if [ "unbekannt" = "$action" ]; then aufruf; exit 1; fi | |
"$action" "$systems" | |
exit 0 | |
# EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment