File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,20 @@ gen_config_file() {
3333}
3434
3535
36+ if ! [ $( id -u) = 0 ]; then
37+ log_err " Please run the install script as root or with sudo"
38+ exit 1
39+ fi
3640echo " Installing cs-custom-bouncer"
3741install_custom_bouncer
3842gen_apikey
3943gen_binary_path
4044gen_config_file
45+ systemctl enable cs-custom-bouncer.service
46+ if ! [ -f " $BINARY_PATH " ]; then
47+ echo " $BINARY_PATH doesn't exist, can't start cs-custom-bouncer service."
48+ echo " Please edit ${CONFIG_DIR} cs-custom-bouncer.yaml with a real binary path and run 'sudo systemctl start cs-custom-bouncer'."
49+ exit 1
50+ fi
51+ systemctl start cs-custom-bouncer.service
4152echo " cs-custom-bouncer service has been installed!"
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ SYSTEMD_PATH_FILE=" /etc/systemd/system/cs-custom-bouncer.service"
4+ LOG_FILE=" /var/log/cs-custom-bouncer.log"
5+ CONFIG_DIR=" /etc/crowdsec/cs-custom-bouncer/"
6+ BIN_PATH_INSTALLED=" /usr/local/bin/cs-custom-bouncer"
7+
8+ uninstall () {
9+ systemctl stop cs-custom-bouncer
10+ rm -rf " ${CONFIG_DIR} "
11+ rm -f " ${SYSTEMD_PATH_FILE} "
12+ rm -f " ${BIN_PATH_INSTALLED} "
13+ rm -f " ${LOG_FILE} "
14+ }
15+
16+ uninstall
17+
18+ echo " cs-custom-bouncer uninstall successfully"
You can’t perform that action at this time.
0 commit comments