Fixed several bugs
This commit is contained in:
parent
9c92ce024b
commit
cfea3898ce
@ -32,23 +32,25 @@ fi
|
|||||||
#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')
|
backup_dir_remote="/media/backup/"$(date +'%Y/%m/%d')
|
||||||
nextcloud_dir="/var/www/nextcloud"
|
nextcloud_dir="/var/www/nextcloud"
|
||||||
remote_ip="192.168.178."
|
remote_ip="192.168.178.59"
|
||||||
|
|
||||||
# Back the fuck up bro...
|
# Back the fuck up bro...
|
||||||
# Shuting down services for backup
|
# Shuting down services for backup
|
||||||
cd $nextcloud_dir
|
cd $nextcloud_dir
|
||||||
sudo -u www-data php occ maintenance:mode --on
|
sudo -u www-data php occ maintenance:mode --on
|
||||||
sudo serive apache2 stop
|
sudo service apache2 stop
|
||||||
sudo mysqldump --single-transaction nextcloud > /tmp/mysqldump/nextcloud.sql
|
sudo mysqldump --single-transaction nextcloud > /tmp/nextcloud.sql
|
||||||
sudo mkdir /tmp/gitea-dump
|
sudo mkdir /tmp/gitea-dump
|
||||||
sudo chown -R git:git /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"
|
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
|
# Create rote directory
|
||||||
sudo ssh backup@$remote_ip sudo mkdir -p $backup_dir_remote/gitea mkdir $backup_dir_remote/nextcloud mkdir $backup_dir_remote/mysql
|
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
|
# copy the shit over
|
||||||
sudo screen -dmS backup -t backup bash -c "rsync -Aavr --progress -e ssh $nextcloud_dir backup-user@$remote_ip:$backup_dir_remote/nextcloud;
|
sudo screen -dmS backup -t backup bash -c "rsync -Aavr --progress -e ssh $nextcloud_dir/ backup-user@$remote_ip:$backup_dir_remote/nextcloud;
|
||||||
rsync -Aavr --progress -e ssh /tmp/nextcloud.sql backup-user@$remote_ip:$backup_dir_remote/mysql/;
|
rsync -Aavr --progress -e ssh /tmp/nextcloud.sql backup-user@$remote_ip:$backup_dir_remote/mysql/;
|
||||||
rsync -Aavr --progress -e ssh /tmp/gitea-dump/backup.zip backup-user@$remote_ip:$backup_dir_remote/gitea/"
|
rsync -Aavr --progress -e ssh /tmp/gitea-dump/backup.zip backup-user@$remote_ip:$backup_dir_remote/gitea/;
|
||||||
|
sudo -u www-data php occ maintenance:mode --off"
|
||||||
|
sudo screen -R backup
|
||||||
|
|
||||||
# Start back up
|
# Start back up
|
||||||
sudo service apache2 start
|
sudo service apache2 start
|
||||||
@ -63,6 +65,4 @@ cd $nextcloud_dir
|
|||||||
# [Nn]* ) sudo -u www-data php occ maintenance:mode --off;;
|
# [Nn]* ) sudo -u www-data php occ maintenance:mode --off;;
|
||||||
# * ) echo "Please answer yes or no.";;
|
# * ) echo "Please answer yes or no.";;
|
||||||
# esac
|
# esac
|
||||||
# done
|
# done
|
||||||
|
|
||||||
sudo -u www-data php occ maintenance:mode --off
|
|
Loading…
Reference in New Issue
Block a user