From 3886de5b7caa46f4e07609ff7f9974b7a2e9a39e Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Thu, 10 Dec 2020 00:00:02 +0000 Subject: [PATCH] add postgres vacuum --- backup.sh | 7 ++++++- update.sh | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/backup.sh b/backup.sh index a13315c7..302a4f19 100755 --- a/backup.sh +++ b/backup.sh @@ -1,6 +1,6 @@ #!/bin/bash -SCRIPT_VERSION="4" +SCRIPT_VERSION="5" SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/backup.sh' GREEN='\033[0;32m' @@ -50,6 +50,11 @@ if [ -d /meshcentral/meshcentral-coredumps ]; then rm -f /meshcentral/meshcentral-coredumps/* fi +printf >&2 "${GREEN}Running postgres vacuum${NC}\n" +sudo -u postgres psql -d tacticalrmm -c "vacuum full logs_auditlog" +sudo -u postgres psql -d tacticalrmm -c "vacuum full logs_pendingaction" +sudo -u postgres psql -d tacticalrmm -c "vacuum full agents_agentoutage" + dt_now=$(date '+%Y_%m_%d__%H_%M_%S') tmp_dir=$(mktemp -d -t tacticalrmm-XXXXXXXXXXXXXXXXXXXXX) sysd="/etc/systemd/system" diff --git a/update.sh b/update.sh index 2f4a92d8..2ee7e4bb 100644 --- a/update.sh +++ b/update.sh @@ -1,6 +1,6 @@ #!/bin/bash -SCRIPT_VERSION="99" +SCRIPT_VERSION="100" SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/update.sh' LATEST_SETTINGS_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py' YELLOW='\033[1;33m' @@ -177,6 +177,11 @@ sudo cp /rmm/api/tacticalrmm/core/goinstaller/bin/goversioninfo /usr/local/bin/ sudo chown ${USER}:${USER} /usr/local/bin/goversioninfo sudo chmod +x /usr/local/bin/goversioninfo +printf >&2 "${GREEN}Running postgres vacuum${NC}\n" +sudo -u postgres psql -d tacticalrmm -c "vacuum full logs_auditlog" +sudo -u postgres psql -d tacticalrmm -c "vacuum full logs_pendingaction" +sudo -u postgres psql -d tacticalrmm -c "vacuum full agents_agentoutage" + if [[ "${CURRENT_PIP_VER}" != "${LATEST_PIP_VER}" ]]; then rm -rf /rmm/api/env cd /rmm/api