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
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" ]
then
echo "system-backup <option> [USB Dir]"
@ -8,16 +13,27 @@ if [ "$1" = "-h" ]
echo
echo "Options:"
echo
echo "-d [USB Dir] [directory to back up]"
echo "-n use SCP instead of USB"
#echo "-d [USB Dir] [directory to back up]"
#echo "-n use SCP instead of USB"
echo
exit 0
fi
if [ "$1" = "-d" ]
then
sudo mount /dev/sd
mv "$2"
sudo mount "$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
exit 0
fi