Last active
November 4, 2020 14:14
-
-
Save kriegalex/b40d6c11883f4d49fcdb7b87dbfaaeb1 to your computer and use it in GitHub Desktop.
Utility scripts for Nextcloud & MySQL/MariaDB maintenance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ##Turn on maintenance mode | |
| docker exec -it nextcloud occ maintenance:mode --on | |
| ##Backup current nextcloud install | |
| docker exec -it nextcloud mv /config/www/nextcloud /config/www/nextcloud-backup | |
| ##Grab newest nextcloud release and unpack it | |
| docker exec -it nextcloud wget https://download.nextcloud.com/server/releases/latest.tar.bz2 -P /config | |
| docker exec -it nextcloud tar -xvf /config/latest.tar.bz2 -C /config/www | |
| ##Copy across old config.php from backup | |
| docker exec -it nextcloud cp /config/www/nextcloud-backup/config/config.php /config/www/nextcloud/config/config.php | |
| ##Now Restart docker container | |
| docker restart nextcloud | |
| ##Perform upgrade | |
| docker exec -it nextcloud occ upgrade | |
| ##Turn off maintenance mode | |
| docker exec -it nextcloud occ maintenance:mode --off | |
| ## Now Restart docker container | |
| docker restart nextcloud |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| mysqldump --single-transaction -h [server] -u [username] -p"[password]" [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ##Remove backup folder | |
| docker exec -it nextcloud rm -rf /config/www/nextcloud-backup | |
| ##Remove Nextcloud tar file | |
| docker exec -it nextcloud rm /config/latest.tar.bz2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment