#!/bin/bash # note there are multiple processes to be catched by sshg-* [[ ! -x `which sshguard` ]] && echo sshguard executable not found in path && exit 1 if [[ -n `pgrep sshguard` ]]; then echo old processes: pgrep -a sshg echo killing sshg pkill sshg sleep 1 fi if [[ -z `pgrep sshguard` ]]; then echo starting sshguard rm -f /var/run/sshguard.pid sshguard >> /var/log/sshguard.log 2>&1 & sleep 1 pgrep -a sshg else echo ERROR: sshg processes are still running pgrep -a sshg fi