summaryrefslogtreecommitdiff
path: root/puppet/modules/stunnel/templates/refresh_stunnel.sh.erb
blob: 1af0cff72b7f1cae6e663db35a929f9ff59b1af7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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