2017-06-08 11:21:36 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# Start/stop/restart firewalld.
|
|
|
|
|
|
|
|
# Start firewalld:
|
|
|
|
firewalld_start() {
|
2017-07-21 07:48:46 +02:00
|
|
|
[ -r /etc/default/firewalld ] && source /etc/default/firewalld
|
2017-06-08 11:21:36 +02:00
|
|
|
echo -n "Starting FireWallD daemon: /usr/sbin/firewalld "
|
|
|
|
/usr/sbin/firewalld $FIREWALLD_ARGS
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
# Stop firewalld:
|
|
|
|
firewalld_stop() {
|
|
|
|
echo -n "Stopping FireWallD daemon..."
|
|
|
|
if [ -r /var/run/firewalld.pid ]; then
|
|
|
|
kill -HUP $(cat /var/run/firewalld.pid)
|
|
|
|
rm -f /var/run/firewalld.pid
|
|
|
|
else
|
|
|
|
killall -HUP -q firewalld
|
|
|
|
fi
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
# Restart firewalld:
|
|
|
|
firewalld_restart() {
|
|
|
|
firewalld_stop
|
|
|
|
sleep 1
|
|
|
|
firewalld_start
|
|
|
|
}
|
|
|
|
|
|
|
|
# Check if firewalld is running
|
|
|
|
firewalld_status() {
|
|
|
|
if [ -e /var/run/firewalld.pid ]; then
|
|
|
|
echo "firewalld is running as pid $(cat /var/run/firewalld.pid)."
|
|
|
|
else
|
|
|
|
echo "firewalld is stopped."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
firewalld_start
|
|
|
|
;;
|
|
|
|
'stop')
|
|
|
|
firewalld_stop
|
|
|
|
;;
|
|
|
|
'restart')
|
|
|
|
firewalld_restart
|
|
|
|
;;
|
|
|
|
'status')
|
|
|
|
firewalld_status
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "usage $0 start|stop|restart|status"
|
|
|
|
esac
|