Update backup.sh

This commit is contained in:
dinger1986 2023-05-11 19:45:41 +01:00 committed by GitHub
parent 64bb61b009
commit fce511a18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 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,6 +8,11 @@ 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
@ -17,11 +22,6 @@ if [[ $* == *--schedule* ]]; then
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
@ -82,19 +82,19 @@ 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
sudo chown -R ${USER}:${USER} /rmmbackups
month_day=$(date +"%d")
week_day=$(date +"%u")