From 0ef5027234fa6eaa9716abc9dd5ddcc5e67a3fe5 Mon Sep 17 00:00:00 2001 From: Cameron Norman Date: Sat, 19 Apr 2014 14:12:20 -0700 Subject: [PATCH] Change Upstart job to track PID of the server This only works correctly if the client does not fork itself when starting the server (which forks twice further). --- files/fail2ban.upstart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/files/fail2ban.upstart b/files/fail2ban.upstart index ccf267f0..8a7ba10c 100644 --- a/files/fail2ban.upstart +++ b/files/fail2ban.upstart @@ -3,5 +3,13 @@ description "fail2ban - ban hosts that cause multiple authentication errors" start on filesystem and started networking stop on deconfiguring-networking -pre-start exec /usr/bin/fail2ban-client -x start +expect daemon +respawn + +pre-start script + [ -d /var/run/fail2ban ] || mkdir -p /var/run/fail2ban +end script + +exec /usr/bin/fail2ban-client -x start + post-stop exec /usr/bin/fail2ban-client stop