From 6133bdc42cbbbda38f400825ef7f9f2a47f4ac96 Mon Sep 17 00:00:00 2001 From: bvdberg01 Date: Sat, 23 Nov 2024 19:25:07 +0100 Subject: [PATCH] Fixed issues after PR review --- ct/listmonk.sh | 5 ++--- install/listmonk-install.sh | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ct/listmonk.sh b/ct/listmonk.sh index 12bdd55d..a44f147c 100644 --- a/ct/listmonk.sh +++ b/ct/listmonk.sh @@ -60,12 +60,11 @@ if [[ ! -f /etc/systemd/system/listmonk.service ]]; then msg_error "No ${APP} In RELEASE=$(curl -s https://api.github.com/repos/knadh/listmonk/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then - msg_info "Stopping ${APP}" systemctl stop listmonk msg_ok "Stopped ${APP}" - msg_info "Updating $APP to v${RELEASE}" + msg_info "Updating ${APP} to v${RELEASE}" cd /opt wget -q "https://github.com/knadh/listmonk/releases/download/v${RELEASE}/listmonk_${RELEASE}_linux_amd64.tar.gz" tar -xzf "listmonk_${RELEASE}_linux_amd64.tar.gz" -C /opt/listmonk @@ -78,7 +77,7 @@ if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_v msg_ok "Started ${APP}" msg_info "Cleaning up" - rm -r "/opt/listmonk_${RELEASE}_linux_amd64.tar.gz" + rm -rf "/opt/listmonk_${RELEASE}_linux_amd64.tar.gz" msg_ok "Cleaned" msg_ok "Updated Successfully" diff --git a/install/listmonk-install.sh b/install/listmonk-install.sh index 31979194..d29c8618 100644 --- a/install/listmonk-install.sh +++ b/install/listmonk-install.sh @@ -27,7 +27,7 @@ DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) $STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;" { -echo "listmonk Database Credentials" +echo "listmonk-Credentials" echo -e "listmonk Database User: \e[32m$DB_USER\e[0m" echo -e "listmonk Database Password: \e[32m$DB_PASS\e[0m" echo -e "listmonk Database Name: \e[32m$DB_NAME\e[0m" @@ -42,8 +42,7 @@ wget -q "https://github.com/knadh/listmonk/releases/download/v${RELEASE}/listmon tar -xzf "listmonk_${RELEASE}_linux_amd64.tar.gz" -C /opt/listmonk $STD /opt/listmonk/listmonk --new-config --config /opt/listmonk/config.toml -sed -i 's/address = "localhost:9000"/address = "0.0.0.0:9000"/' /opt/listmonk/config.toml -sed -i 's/^password = ".*"/password = "'"$DB_PASS"'"/' /opt/listmonk/config.toml +sed -i -e 's/address = "localhost:9000"/address = "0.0.0.0:9000"/' -e 's/^password = ".*"/password = "'"$DB_PASS"'"/' /opt/listmonk/config.toml $STD /opt/listmonk/listmonk --install --yes --config /opt/listmonk/config.toml echo "${RELEASE}" >/opt/${APPLICATION}_version.txt @@ -72,7 +71,7 @@ motd_ssh customize msg_info "Cleaning up" -rm -r "/opt/listmonk_${RELEASE}_linux_amd64.tar.gz" +rm -rf "/opt/listmonk_${RELEASE}_linux_amd64.tar.gz" $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned" \ No newline at end of file