summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2013-06-11 14:00:27 -0400
committerMicah Anderson <micah@riseup.net>2013-06-12 20:22:24 -0400
commita336f39c441b7b3706278332cc63782d2de0e299 (patch)
tree619e2a2e4aa0c117978a08485acda3becf01c2aa /templates
parent75d387fc8aff12232fdeae2efbbfccdd91f94656 (diff)
Previous to this commit, when a stunnel::service definition was removed, the
/etc/stunnel/${name}.conf was left, and the stunnel remained running. Also, if you changed a parameter in a stunnel::service definition, the .conf file was changed, but the service restart may not happen properly. This commit adds functionality to properly clean up running stunnels that are no longer managed, and restart managed ones whose parameters have changed
Diffstat (limited to 'templates')
-rw-r--r--templates/refresh_stunnel.sh.erb22
1 files changed, 22 insertions, 0 deletions
diff --git a/templates/refresh_stunnel.sh.erb b/templates/refresh_stunnel.sh.erb
new file mode 100644
index 0000000..1af0cff
--- /dev/null
+++ b/templates/refresh_stunnel.sh.erb
@@ -0,0 +1,22 @@
+#!/bin/sh -x
+
+for difference in `diff -q /etc/stunnel <%= @stunnel_staging %>/configs | grep differ | awk '{print $2}'`
+do
+ old_config=`basename $difference`
+ /etc/init.d/stunnel4 stop $(basename $old_config .conf)
+ rm $difference
+done
+
+for only in `diff -q /etc/stunnel <%= @stunnel_staging %>/configs | grep 'Only in /etc/stunnel:' | awk '{print $4}'`
+do
+ old_config=`basename $only`
+ /etc/init.d/stunnel4 stop $(basename $only .conf)
+ rm /etc/stunnel/${only}
+done
+
+cp <%= @stunnel_staging %>/configs/*.conf /etc/stunnel
+
+/etc/init.d/stunnel4 start
+
+
+