mirror of
https://github.com/chaifeng/ufw-docker.git
synced 2025-05-10 13:38:32 +02:00
check ufw status first
This commit is contained in:
parent
a167d3e4ab
commit
89b3aaa5aa
1 changed files with 5 additions and 5 deletions
10
ufw-docker
10
ufw-docker
|
@ -162,10 +162,14 @@ function err() {
|
|||
}
|
||||
|
||||
function die() {
|
||||
err "Fatal:" "$@"
|
||||
err "ERROR:" "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ! ufw status 2>/dev/null | grep -Fq "Status: active" ; then
|
||||
die "UFW is disabled or you are not root user."
|
||||
fi
|
||||
|
||||
case "$UFW_ACTION" in
|
||||
delete)
|
||||
shift || true
|
||||
|
@ -176,10 +180,6 @@ case "$UFW_ACTION" in
|
|||
list|allow)
|
||||
shift || true
|
||||
|
||||
if ! ufw status | grep -F "Status: active" &>/dev/null; then
|
||||
die "UFW is not actived or your are not root user."
|
||||
fi
|
||||
|
||||
INSTANCE_ID="${1:?Docker instance name/ID cannot be empty.}"
|
||||
INSTANCE_NAME="$(ufw-docker--instance-name "$INSTANCE_ID")"
|
||||
shift || true
|
||||
|
|
Loading…
Add table
Reference in a new issue