There is no need to write a shell script and call it from cron. You can load the rules from the /etc/pf.conf and sleepf or 120 seconds then disable pf:
#/sbin/pfctl -f /etc/pf.conf && sleep 120 && /sbin/pfctl -d
Where,
- -f /etc/pf.conf - Load the rules contained in /etc/pf.conf.
- -d - Disable the packet filter.
- sleep 200: The sleep command suspends execution for a minimum of 200 seconds before calling the next command.
# /sbin/pfctl -nf /etc/pf.conf
Finally, && (AND list) shell control operator is to used run next command only if, first command returns an exit status of zero. So each command in list must be successful in order to run next command.
# /sbin/pfctl -nf /etc/pf.conf && /sbin/pfctl -f /etc/pf.conf && sleep 120 && /sbin/pfctl -d
No comments:
Post a Comment