properly call sleep

This commit is contained in:
Costa Tsaousis (ktsaou) 2017-09-19 01:48:48 +03:00
parent b94bf08508
commit d5d001b6f9
No known key found for this signature in database
GPG Key ID: 29CA335889B9A863

@ -1378,24 +1378,24 @@ ${MKDIR_CMD} "${FIREHOL_DIR}/fast/table6s" || exit 1
# this is needed only when we are going to save the firewall
# with iptables-save.
file open 20 "${FIREHOL_DIR}/firewall_restore_commands.sh" w || exit 1
$CAT_CMD >&20 <<'EOFMTL'
$CAT_CMD >&20 <<EOFMTL
#!/bin/sh
# Generated by FireHOL to execute additional actions
# to restore the generated firewall.
#
# a function to help us save a value to a file
postprocess_echo_to() { echo "${1}" >"${2}"; }
postprocess_echo_to() { echo "\${1}" >"\${2}"; }
postprocess_wait_netfilter() {
maxwait=60
waiting=0
while [ ! -f /proc/sys/net/netfilter/nf_conntrack_max -a ${waiting} -le ${maxwait} ]
while [ ! -f /proc/sys/net/netfilter/nf_conntrack_max -a \${waiting} -le \${maxwait} ]
do
echo >&2 "netfilter is not ready; waiting ${waiting} of ${maxwait}"
sleep 1
waiting=$(( waiting + 1 ))
echo >&2 "netfilter is not ready; waiting \${waiting} of \${maxwait}"
${SLEEP_CMD} 1
waiting=\$(( waiting + 1 ))
done
[ ${waiting} -gt ${maxwait} ] && return 1
[ \${waiting} -gt \${maxwait} ] && return 1
return 0
}