Starting sshd automatically if it is down/failed

I am trying to create a Bash .sh script for a cronjob that starts the OpenSSH server if it is down or failed.

Last night the SSH server was down and when I tried to access it today (from work) the connection was refused ofc.
No traces in the /var/log/messages for the failure.

So the question is – how to determine is sshd running so if it is not to “sudo service ssh start” it?

Thanks in advance!

Source: linux

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.