From 65ab14e68b6d370afc5c714ea57975d1555c90f1 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Fri, 7 Oct 2022 17:15:37 +0000 Subject: [PATCH] cleanup socket fixes #1210 --- install.sh | 6 ++++-- update.sh | 31 ++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 0a1b9497..4830f038 100644 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SCRIPT_VERSION="68" +SCRIPT_VERSION="69" SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/install.sh' sudo apt install -y curl wget dirmngr gnupg lsb-release @@ -482,7 +482,7 @@ echo "${rmmservice}" | sudo tee /etc/systemd/system/rmm.service > /dev/null daphneservice="$(cat << EOF [Unit] -Description=django channels daemon +Description=django channels daemon v2 After=network.target [Service] @@ -491,6 +491,8 @@ Group=www-data WorkingDirectory=/rmm/api/tacticalrmm Environment="PATH=/rmm/api/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ExecStart=/rmm/api/env/bin/daphne -u /rmm/daphne.sock tacticalrmm.asgi:application +ExecStartPre=rm -f /rmm/daphne.sock +ExecStartPre=rm -f /rmm/daphne.sock.lock Restart=always RestartSec=3s diff --git a/update.sh b/update.sh index 95c09bad..6d0bacf0 100644 --- a/update.sh +++ b/update.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SCRIPT_VERSION="139" +SCRIPT_VERSION="140" SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/update.sh' LATEST_SETTINGS_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py' YELLOW='\033[1;33m' @@ -127,6 +127,35 @@ printf >&2 "${GREEN}Stopping ${i} service...${NC}\n" sudo systemctl stop ${i} done +CHECK_DAPHNE=$(grep v2 /etc/systemd/system/daphne.service) +if ! [[ $CHECK_DAPHNE ]]; then + +sudo rm -f /etc/systemd/system/daphne.service + +daphneservice="$(cat << EOF +[Unit] +Description=django channels daemon v2 +After=network.target + +[Service] +User=${USER} +Group=www-data +WorkingDirectory=/rmm/api/tacticalrmm +Environment="PATH=/rmm/api/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" +ExecStart=/rmm/api/env/bin/daphne -u /rmm/daphne.sock tacticalrmm.asgi:application +ExecStartPre=rm -f /rmm/daphne.sock +ExecStartPre=rm -f /rmm/daphne.sock.lock +Restart=always +RestartSec=3s + +[Install] +WantedBy=multi-user.target +EOF +)" +echo "${daphneservice}" | sudo tee /etc/systemd/system/daphne.service > /dev/null +sudo systemctl daemon-reload +fi + rm -f /rmm/api/tacticalrmm/app.ini uwsgini="$(cat << EOF