Added USB functionality
This commit is contained in:
parent
186f7176fe
commit
3ed9c27162
23
games-backup
23
games-backup
@ -9,22 +9,31 @@ if [ "$1" = "-h" ]
|
||||
echo
|
||||
echo "Options:"
|
||||
echo
|
||||
#echo "-d [USB Dir]"
|
||||
echo "-d [USB Drive]"
|
||||
echo
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Initialize variables
|
||||
#backup_dir="/mnt/USB/Backup/"$(date +'%Y/%m/%d')
|
||||
backup_dir="/mnt/USB/Backup/"$(date +'%Y/%m/%d')
|
||||
backup_dir_remote="/media/backup/games/"$(date +'%Y/%m/%d')
|
||||
minecraft_dir="/media/games/bukkit"
|
||||
csgo_dir="/var/"
|
||||
remote_ip="192.168.178."
|
||||
|
||||
# Back the fuck up bro...
|
||||
sudo ssh backup@$remote_ip sudo mkdir -p $backup_dir_remote/mc mkdir $backup_dir_remote/csgo
|
||||
if [ "$1" = "-d" ]
|
||||
then
|
||||
sudo mkdir /mnt/USB/
|
||||
sudo mount $2 /mnt/USB/
|
||||
sudo mkdir -p $backup_dir"/mc"
|
||||
sudo mkdir $backup_dir"/cs-go"
|
||||
sudo screen -dmS backup -t backup bash -c "rsync -Aarz --progress -e ssh $minecraft_dir/ $backup_dir/mc;
|
||||
rsync -Aarz --progress -e ssh $csgo_dir $backup_dir/cs-go/"
|
||||
else
|
||||
# Create remote directory
|
||||
sudo ssh backup-user@$remote_ip mkdir -p $backup_dir_remote/cs-go mkdir $backup_dir_remote/mc
|
||||
# copy the shit over
|
||||
sudo screen -dmS backup -t backup bash -c "rsync -Aavr --progress -e ssh $minecraft_dir backup-user@$remote_ip:$backup_dir_remote/mc;
|
||||
rsync -Aavr --progress -e ssh $csgo_dir backup-user@$remote_ip:$backup_dir_remote/csgo;
|
||||
"
|
||||
sudo screen -dmS backup -t backup bash -c "rsync -Aarz --progress -e ssh $minecraft_dir/ backup-user@$remote_ip:$backup_dir_remote/mc;
|
||||
rsync -Aarz --progress -e ssh $csgo_dir backup-user@$remote_ip:$backup_dir_remote/cs-go/"
|
||||
fi
|
@ -9,32 +9,18 @@ if [ "$1" = "-h" ]
|
||||
echo
|
||||
echo "Options:"
|
||||
echo
|
||||
#echo "-d [USB Dir]"
|
||||
echo "-d [USB Drive]"
|
||||
echo
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# if [ "$1" = "-d" ]
|
||||
# then
|
||||
# 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 -Aav --progress $nextcloud_dir/ $backup_dir"/nextcloud"
|
||||
# else
|
||||
# sudo mount /dev/sdb0
|
||||
# sudo mkdir /mnt/USB/Backup-whole-System/
|
||||
# sudo screen -dmS backup -t backup
|
||||
# fi
|
||||
|
||||
# Initialize variables
|
||||
#backup_dir="/mnt/USB/Backup/"$(date +'%Y/%m/%d')
|
||||
backup_dir="/mnt/USB/Backup/"$(date +'%Y/%m/%d')
|
||||
backup_dir_remote="/media/backup/"$(date +'%Y/%m/%d')
|
||||
nextcloud_dir="/var/www/nextcloud"
|
||||
remote_ip="192.168.178.59"
|
||||
|
||||
# Back the fuck up bro...
|
||||
# Shuting down services for backup
|
||||
cd $nextcloud_dir
|
||||
sudo -u www-data php occ maintenance:mode --on
|
||||
@ -43,12 +29,26 @@ sudo mysqldump --single-transaction nextcloud > /tmp/nextcloud.sql
|
||||
sudo mkdir /tmp/gitea-dump
|
||||
sudo chown -R git:git /tmp/gitea-dump/
|
||||
sudo -u git /usr/local/bin/gitea dump --config /etc/gitea/app.ini --file "/tmp/gitea-dump/backup.zip" --tempdir "/tmp/gitea-dump"
|
||||
# Create rote directory
|
||||
|
||||
# Back the fuck up bro...
|
||||
if [ "$1" = "-d" ]
|
||||
then
|
||||
sudo mkdir /mnt/USB/
|
||||
sudo mount $2 /mnt/USB/
|
||||
sudo mkdir -p $backup_dir"/nextcloud"
|
||||
sudo mkdir $backup_dir"/mysql"
|
||||
sudo mkdir $backup_dir"/gitea"
|
||||
sudo screen -dmS backup -t backup bash -c "rsync -Aarz --progress -e ssh $nextcloud_dir/ $backup_dir/nextcloud;
|
||||
rsync -Aar --progress -e ssh /tmp/nextcloud.sql $backup_dir/mysql/;
|
||||
rsync -Aarz --progress -e ssh /tmp/gitea-dump/backup.zip $backup_dir/gitea/"
|
||||
else
|
||||
# Create remote directory
|
||||
sudo ssh backup-user@$remote_ip mkdir -p $backup_dir_remote/gitea mkdir $backup_dir_remote/nextcloud mkdir $backup_dir_remote/mysql
|
||||
# copy the shit over
|
||||
sudo screen -dmS backup -t backup bash -c "rsync -Aarz --progress -e ssh $nextcloud_dir/ backup-user@$remote_ip:$backup_dir_remote/nextcloud;
|
||||
rsync -Aar --progress -e ssh /tmp/nextcloud.sql backup-user@$remote_ip:$backup_dir_remote/mysql/;
|
||||
rsync -Aarz --progress -e ssh /tmp/gitea-dump/backup.zip backup-user@$remote_ip:$backup_dir_remote/gitea/"
|
||||
fi
|
||||
|
||||
# Start back up
|
||||
sudo service apache2 start
|
||||
|
Loading…
Reference in New Issue
Block a user