Commit d83e6eec authored by Cédric BRINER's avatar Cédric BRINER Committed by Cédric BRINER
Browse files

modified the option for sync

parent 06031711
......@@ -4,7 +4,8 @@
GIT_HASH_VERSION_OF_IDP_TOOLS=
#source /usr/local/share/login.sh
IDP_HOME=/opt/shibboleth-idp
RESTART_DAEMON="True"
RESTART_MYSQL="True"
RESTART_OTHER_DAEMON="True"
TUNGSTEN_TIME_MAX_STABILIZE=3
TUNGSTEN_TIME_MAX_SYNC=500
......@@ -1172,11 +1173,11 @@ function sync
fi
# restart
echo -e " \e[34m- restart mysql\e[0m:"
if test ${RESTART_DAEMON} = "True"
if [[ $RESTART_MYSQL = "True" ]]
then
ssh root@${h} "systemctl restart mysql.service" | indent 5
else
echo -e " \e[34mmysql will not be restarted as the flag (RESTART_DAEMON) is set false\e[0m"
echo -e " \e[34mmysql will not be restarted as the flag (RESTART_MYSQL) is set false\e[0m"
fi
# credentials
echo -en " \e[34m- test if credentials are good\e[0m: "
......@@ -1327,11 +1328,11 @@ EOF
ssh root@${h} "ls -1 /etc/apache2/sites-enabled/*conf | xargs -I@ basename @ | xargs -I@ a2ensite @" | indent 5
# restart apache
echo -e " \e[34m- restart apache\e[0m"
if test ${RESTART_DAEMON} = "True"
if test ${RESTART_OTHER_DAEMON} = "True"
then
ssh root@${h} "service apache2 restart" | indent 5
else
echo -e " \e[34mapache2 will not be restarted as the flag (RESTART_DAEMON) is set false\e[0m"
echo -e " \e[34mapache2 will not be restarted as the flag (RESTART_OTHER_DAEMON) is set false\e[0m"
fi
#
......@@ -1371,12 +1372,12 @@ EOF
make_distant_link "${h}" /etc/ssl/private/${lb_service_name}.unige.ch.key /etc/ssl/private/server.key
# rebuild tomcat
echo -e " \e[34m- rebuild war (rebuild the war, stop tomcat, remove old war, start tomcat)\e[0m"
if test ${RESTART_DAEMON} = "True"
if test ${RESTART_OTHER_DAEMON} = "True"
then
ssh root@${h} idp-tools rewar | indent 3
else
echo -e " \e[34mwar will no be re-consructed as this imply a restart of tomcat7\e[0m"
echo -e " \e[34mand as the flag (RESTART_DAEMON) is set false\e[0m"
echo -e " \e[34mand as the flag (RESTART_OTHER_DAEMON) is set false\e[0m"
fi
#
# TUNGSTEN
......@@ -1966,7 +1967,7 @@ function usage_n_exit
pb " | dump-mysql"
pb " | load-mysql <dump_path>]"
pb " | shell-mysql"
pb " | sync [--no-restart] <to_host>"
pb " | sync [--no-restart-mysql] [--no-restart-other-daemon] <to_host>"
pb " | tungsten-watch-sync <other_host>"
pb " | rewar"
pb " | reload <pattern_beans> [host,[...]]"
......@@ -2024,20 +2025,24 @@ case "$1" in
sync)
has_ssh_agent
shift
# --no-restart
if test ! -z "$1"
then
if test "${1:0:1}" = "-"
then
if test "$1" = "--no-restart"
then
RESTART_DAEMON="False"
# sync option ["-no-restart-mysql", "--no-restart-other-daemon"]
while test -n "$1"
do
case "$1" in
--no-restart-mysql)
RESTART_MYSQL="False"
shift
else
;;
--no-restart-other-daemon)
RESTART_OTHER_DAEMON="False"
shift
;;
*)
echo "auieaueaeaea"
usage_n_exit
fi
fi
fi
;;
esac
done
# host
if test -z "$1"
then
......@@ -2049,7 +2054,7 @@ case "$1" in
if [[ ! -d /${IDP_HOME}/idp-tools_sync_logs/ ]]; then
mkdir /${IDP_HOME}/idp-tools_sync_logs/
fi
echo "RESTART_DAEMON(${RESTART_DAEMON}) Host(${host})"
echo "RESTART_OTHER_DAEMON(${RESTART_OTHER_DAEMON}) Host(${host})"
sync "${host}" 2>&1 | tee /${IDP_HOME}/idp-tools_sync_logs/$(hostname -s)_to_${host}_$(date "+%Y.%m.%d_%Hh%Mm").txt.out
;;
tungsten-watch-sync)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment