diff options
author | stormtracknole <stormtracknole@gmail.com> | 2020-03-20 19:11:39 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-03-20 19:11:39 +0700 |
commit | 4de5fb1d7a3290fb6a04369e993e9e500d48bb5e (patch) | |
tree | f98555f42e4cf005cc3b966ebb6efe6668a7c366 /network/firewalld/rc.firewalld | |
parent | 431e5229c4beec6bd98e135d446bc5bab5b376e4 (diff) | |
download | slackbuilds-4de5fb1d7a3290fb6a04369e993e9e500d48bb5e.tar.gz |
network/firewalld: Update script.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/firewalld/rc.firewalld')
-rw-r--r-- | network/firewalld/rc.firewalld | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/network/firewalld/rc.firewalld b/network/firewalld/rc.firewalld new file mode 100644 index 0000000000..aa0d91b3dc --- /dev/null +++ b/network/firewalld/rc.firewalld @@ -0,0 +1,56 @@ +#!/bin/sh +# Start/stop/restart firewalld. + +# Start firewalld: +firewalld_start() { + [ -r /etc/default/firewalld ] && source /etc/default/firewalld + 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 |