Merge pull request #1511 from dinger1986/develop

Updates to the Update script and backup script
This commit is contained in:
Dan 2023-05-18 22:43:59 -07:00 committed by GitHub
commit 0fd0b9128d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 22 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
SCRIPT_VERSION="22"
SCRIPT_VERSION="23"
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
@ -8,20 +8,38 @@ BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
if [ $EUID -eq 0 ]; then
echo -ne "\033[0;31mDo NOT run this script as root. Exiting.\e[0m\n"
exit 1
fi
if [[ $* == *--schedule* ]]; then
(
crontab -l 2>/dev/null
echo "0 0 * * * /rmm/backup.sh --auto"
) | crontab -
if [ ! -d /rmmbackups ]; then
sudo mkdir /rmmbackups
fi
if [ ! -d /rmmbackups/daily ]; then
sudo mkdir /rmmbackups/daily
fi
if [ ! -d /rmmbackups/weekly ]; then
sudo mkdir /rmmbackups/weekly
fi
if [ ! -d /rmmbackups/monthly ]; then
sudo mkdir /rmmbackups/monthly
fi
sudo chown ${USER}:${USER} -R /rmmbackups
printf >&2 "${GREEN}Backups setup to run at midnight and rotate.${NC}\n"
exit 0
fi
if [ $EUID -eq 0 ]; then
echo -ne "\033[0;31mDo NOT run this script as root. Exiting.\e[0m\n"
exit 1
fi
if [ ! -d /rmmbackups ]; then
sudo mkdir /rmmbackups
sudo chown ${USER}:${USER} /rmmbackups
@ -80,21 +98,6 @@ cp /rmm/api/tacticalrmm/tacticalrmm/local_settings.py ${tmp_dir}/rmm/
if [[ $* == *--auto* ]]; then
if [ ! -d /rmmbackups/daily ]; then
sudo mkdir /rmmbackups/daily
sudo chown ${USER}:${USER} /rmmbackups/daily
fi
if [ ! -d /rmmbackups/weekly ]; then
sudo mkdir /rmmbackups/weekly
sudo chown ${USER}:${USER} /rmmbackups/weekly
fi
if [ ! -d /rmmbackups/monthly ]; then
sudo mkdir /rmmbackups/monthly
sudo chown ${USER}:${USER} /rmmbackups/monthly
fi
month_day=$(date +"%d")
week_day=$(date +"%u")

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
SCRIPT_VERSION="143"
SCRIPT_VERSION="144"
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'
@ -307,6 +307,8 @@ sudo chown ${USER}:${USER} -R ${SCRIPTS_DIR}
sudo chown ${USER}:${USER} /var/log/celery
sudo chown ${USER}:${USER} -R /etc/conf.d/
sudo chown ${USER}:${USER} -R /etc/letsencrypt
sudo chown ${USER}:${USER} -R /rmmbackups
CHECK_CELERY_CONFIG=$(grep "autoscale=20,2" /etc/conf.d/celery.conf)
if ! [[ $CHECK_CELERY_CONFIG ]]; then