linux - Starting sshd automatically if it is down/failed -


i trying create bash .sh script cronjob starts openssh server if down or failed.

last night ssh server down , when tried access today (from work) connection refused ofc. no traces in /var/log/messages failure.

so question - how determine sshd running if not "sudo service ssh start" it?

thanks in advance!

fellas, believe have managed task:

#!/bin/bash service="ssh"  if (( ! $(sudo service ssh status | cut -d" " -f 3 | cut -d"." -f 1) == "running" ))         sudo /etc/init.d/ssh restart fi 

i have changed loglevel verbose, hope next time track more clues regarding failure of sshd.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -