Added default and network

This commit is contained in:
Johannes Schmelz 2021-01-06 22:33:41 +01:00
parent 21d11bd634
commit 50d2642aa4

View File

@ -1,5 +1,10 @@
#!/bin/bash #!/bin/bash
backup_dir="/mnt/USB/Backup/"$(date +'%Y/%m/%d')
cd /var/www/nextcloud
sudo -u www-data php occ maintenance:mode --on
if [ "$1" = "-h" ] if [ "$1" = "-h" ]
then then
echo "system-backup <option> [USB Dir]" echo "system-backup <option> [USB Dir]"
@ -8,16 +13,27 @@ if [ "$1" = "-h" ]
echo echo
echo "Options:" echo "Options:"
echo echo
echo "-d [USB Dir] [directory to back up]" #echo "-d [USB Dir] [directory to back up]"
echo "-n use SCP instead of USB" #echo "-n use SCP instead of USB"
echo echo
exit 0 exit 0
fi fi
if [ "$1" = "-d" ] if [ "$1" = "-d" ]
then then
sudo mount /dev/sd sudo mount "$2"
mv "$2" sudo mkdir -p $backup_dir"/nextcloud"
sudo mkdir $backup_dir"/mysql"
sudo mkdir $backup_dir"/gitea"
sudo screen -dmS backup -t backup rsync -Aavx /var/www/nextcloud/ $backup_dir"/nextcloud"
else
sudo mount /dev/sdb0
sudo mkdir /mnt/USB/Backup-whole-System/
sudo screen -dmS backup -t backup
fi
if [ "$1" = "-n" ]
then
sudo screen -dmS backup -t backup sudo screen -dmS backup -t backup
exit 0 exit 0
fi fi