sync_from_old_server.sh: fix function 'service_exists'; some minor changes in script output.

This commit is contained in:
Christoph 2023-12-10 12:07:43 +01:00
parent 35a7b3a8a5
commit 1ac27093e9

View File

@ -48,7 +48,7 @@ sync_web_dirs=""
# - Sync Apache virtual host configurations
# -
# - Note - following files are excluded:
# -
# -
# - 000-default.conf
# - 000-dehydrated.conf
# - 000-logformat.conf
@ -247,7 +247,7 @@ detect_mysql_version () {
service_exists() {
local n=$1
if [[ $(systemctl list-units --all -t service --full --no-legend "$n.service" | cut -f1 -d' ') == $n.service ]]; then
if [[ $(systemctl list-units --all -t service --full --no-legend "$n.service" | awk '{print$1}') == $n.service ]]; then
return 0
else
return 1
@ -288,7 +288,7 @@ fi
echononl " Backup file /root/bin/.ssh/config"
if [[ -f "/root/.ssh/config" ]] ; then
mv "/root/.ssh/config " "/root/.ssh/config.${cur_date}" > /dev/null 2> $tmp_err_msg
mv "/root/.ssh/config" "/root/.ssh/config.${cur_date}" > /dev/null 2> $tmp_err_msg
if [[ $? -eq 0 ]];then
echo_ok
else
@ -310,7 +310,7 @@ else
fi
echononl " Create temporary file \033[31m\033[1m/root/.ssh/config\033[m .."
echononl " Create temporary file \033[1m/root/.ssh/config\033[m .."
cat <<EOF > "/root/.ssh/config"
Host *
ControlMaster auto
@ -1022,7 +1022,7 @@ else
fi
echononl " Restore file \033[31m\033[1m/root/.ssh/config\033[m .."
echononl " Restore file \033\033[1m/root/.ssh/config\033[m .."
if [[ -f "/root/.ssh/config.${cur_date}" ]] ; then
mv "/root/.ssh/config.${cur_date}" "/root/.ssh/config" > /dev/null 2> $tmp_err_msg
if [[ $? -eq 0 ]] ; then