notify the refresh_stunnel exec when the conf files change
[puppet_stunnel.git] / templates / refresh_stunnel.sh.erb
1 #!/bin/sh -x
2
3 for difference in `diff -q /etc/stunnel <%= @stunnel_staging %>/configs | grep differ | awk '{print $2}'`
4 do 
5     old_config=`basename $difference`
6     /etc/init.d/stunnel4 stop $(basename $old_config .conf)
7     rm $difference
8 done
9
10 for only in `diff -q /etc/stunnel <%= @stunnel_staging %>/configs | grep 'Only in /etc/stunnel:' | awk '{print $4}'`
11 do
12     old_config=`basename $only`
13     /etc/init.d/stunnel4 stop $(basename $only .conf)
14     rm /etc/stunnel/${only}
15 done
16
17 cp <%= @stunnel_staging %>/configs/*.conf /etc/stunnel
18
19 /etc/init.d/stunnel4 start
20
21
22