- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
function SymlinkNextStunnelConfig {
OLDIFS=$IFS
IFS=$'\n'
stunnelConfigs=($(find ${STUNNEL_CONFIG_D} -regex ".*\.conf$"))
IFS=$OLDIFS
if [[ -f ${CURRENT_STUNNEL_CONF} ]]; then
currentConfig=$(readlink -f ${CURRENT_STUNNEL_CONF})
else
currentConfig=""
fi
if [[ ${#stunnelConfigs[@]} -eq 0 ]]; then
echo "No config found in ${STUNNEL_CONFIG_D}"
exit 6
elif [[ ${#stunnelConfigs[@]} -eq 1 ]]; then
nextConfig=${stunnelConfigs[0]}
else {
echo "ZAEBALO. DELAY SYMLINK VRUCHNUYU!"
}
fi
if [[ -L ${CURRENT_STUNNEL_CONF} ]]; then
rm -f ${CURRENT_STUNNEL_CONF}
fi
ln -s ${stunnelConfigs[0]} ${CURRENT_STUNNEL_CONF}
}