Update backup.sh

This commit is contained in:
dinger1986 2023-05-11 19:54:07 +01:00 committed by GitHub
parent fce511a18b
commit 0f147a5518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 15 deletions

View File

@ -18,6 +18,20 @@ if [[ $* == *--schedule* ]]; then
crontab -l 2>/dev/null
echo "0 0 * * * /rmm/backup.sh --auto"
) | crontab -
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 -R ${USER}:${USER} /rmmbackups
printf >&2 "${GREEN}Backups setup to run at midnight and rotate.${NC}\n"
exit 0
fi
@ -80,21 +94,6 @@ cp /rmm/api/tacticalrmm/tacticalrmm/local_settings.py ${tmp_dir}/rmm/
if [[ $* == *--auto* ]]; then
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 -R ${USER}:${USER} /rmmbackups
month_day=$(date +"%d")
week_day=$(date +"%u")