Skip to content

Commit

Permalink
Merge pull request #102 from crowdsecurity/log_err
Browse files Browse the repository at this point in the history
added log_err() to upgrade.sh
  • Loading branch information
AlteredCoder authored Dec 22, 2021
2 parents a38e142 + a3bc174 commit 932c475
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
BIN_PATH_INSTALLED="/usr/local/bin/crowdsec-firewall-bouncer"
BIN_PATH="./crowdsec-firewall-bouncer"

RED='\033[0;31m'
NC='\033[0m'

upgrade_bin() {
rm "${BIN_PATH_INSTALLED}" || (echo "crowdsec-firewall-bouncer is not installed, exiting." && exit 1)
install -v -m 755 -D "${BIN_PATH}" "${BIN_PATH_INSTALLED}"
}


log_err() {
msg=$1
date=$(date +%x:%X)
echo -e "${RED}ERR${NC}[${date}] crowdsec-firewall-bouncer: ${msg}" 1>&2
}

if ! [ $(id -u) = 0 ]; then
log_err "Please run the upgrade script as root or with sudo"
exit 1
Expand Down

0 comments on commit 932c475

Please sign in to comment.