Ensure to restart ssh service

This commit is contained in:
Jeremy Gardais 2019-05-07 11:37:28 +02:00
parent d8e87ee1bc
commit 2342d87d7e
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 12 additions and 0 deletions

View File

@ -63,6 +63,7 @@ function manageSshKeyForBackuppc() ## {{{
chown -R -- "${userLogin}:" "${userHomedir}"
}
## }}}
function ensureSshdIsInstalled() ## {{{
{
### `command -v sshd` still return old value even after openssh-server was removed
@ -81,6 +82,12 @@ function ensureSshdIsInstalled() ## {{{
fi
}
## }}}
function ensureSshdIsRunning() ## {{{
{
### Ensure to completely restart sshd
service ssh --full-restart > /dev/null
}
## }}}
# }}}
@ -111,6 +118,11 @@ if [ "$?" != "${SUCCESS}" ]; then
printf '%b' "${REDB}L'installation du serveur ssh a échoué, installation annulée.${RESET}\\n"
exit "${ERROR}"
fi
ensureSshdIsRunning
if [ "$?" != "${SUCCESS}" ]; then
printf '%b' "${REDB}Le serveur ssh n'a pas correctement démarré, installation annulée.${RESET}\\n"
exit "${ERROR}"
fi
# }}}
exit "${SUCCESS}"