Thus,thisGitHubrepositoryisoutdatedandnotlongermaintainedonGitHub.Pleaseupdateyourreferences.
Nextcloud-Backup-RestoreThisrepositorycontainstwobashscriptsforbackup/restoreofNextcloud.
ItisbasedonaNextcloudinstallationusingnginxandMariaDB(seethe(German)tutorialNextcloudaufUbuntuServer18.04LTSmitnginx,MariaDB,PHP,Let’sEncrypt,RedisundFail2ban).
GeneralinformationForacompletebackupofanyNextcloudinstance,you'llhavetobackuptheseitems:
TheNextcloudfiledirectory(usually/var/www/nextcloud)ThedatadirectoryofNextcloud(it'srecommendedthatthisisnotlocatedinthewebroot,soe.g./var/nextcloud_data)TheNextclouddatabaseMaybealocalexternalstoragemountedintoNextcloudThescriptstakecareoftheseitemstobackupautomatically.
Important:
Aftercloningordownloadingtherepository,you'llhavetoeditthescriptssothattheyrepresentyourcurrentNextcloudinstallation(directories,users,etc.).AllvalueswhichneedtobecustomizedaremarkedwithTODOinthescript'scomments.ThescriptsassumethatNextcloud'sdatadirectoryisnotasubdirectoryoftheNextcloudinstallation(filedirectory).Thegeneralrecommendationisthatthedatadirectoryshouldnotbelocatedsomewhereinthewebfolderofyourwebserver(usually/var/www/),butinadifferentfolder(e.g./var/nextcloud_data).Formoreinformation,seehere.However,ifyourdatadirectoryislocatedundertheNextcloudfiledirectory,you'llhavetochangethescriptssothatthedatadirectoryisnotpartofthebackup/restore(otherwise,itwouldbecopiedtwice).ThescriptsonlybackuptheNextclouddatadirectoryandcanbackupalocalexternalstoragemountedintoNextcloud.IfyouhaveanyotherexternalstoragemountedinNextcloud(e.g.FTP),thesefileshavetobehandledseparately.ThescriptsassumethatyouareusingMySQL/MariaDBasdatabaseforNextcloud.However,italsosupportsPostreSQLdatabases.Inthiscaseyouhavetouncommentthepartsofbackingup/restoringthedatabase.Youshouldhaveenabled4bytesupport(seeNextcloudAdministrationManual)onyourNextclouddatabase.Otherwise,whenyouhavenotenabled4bytesupport,youhavetoedittherestorescript,sothatthedatabaseisnotcreatedwith4bytesupportenabled.BackupInordertocreateabackup,simplycallthescriptNextcloudBackup.shonyourNextcloudmachine.Ifthisscriptiscalledwithoutparameter,thebackupissavedinadirectorywiththecurrenttimestampinyourmainbackupdirectory:Asanexample,thiswouldbe/media/hdd/nextcloud_backup/20170910_132703.Thebackupscriptcanalsobecalledwithaparameterspecifiyingthemainbackupdirectory,e.g../NextcloudBackup.sh/media/hdd/nextcloud_backup.Inthiscase,thedirectoryspecifiedwillbeusedasmainbackupdirectory.
RestoreForrestore,justcallNextcloudRestore.sh.Thisscriptexpectsatleastoneparameterspecifyingthenameofthebackuptoberestored.Inourexample,thiswouldbe20170910_132703(thetimestampofthebackupcreatedbefore).Thefullcommandforarestorewouldbe./NextcloudRestore.sh20170910_132703.Youcanalsospecifythemainbackupdirectorywithasecondparameter,e.g../NextcloudRestore.sh20170910_132703/media/hdd/nextcloud_backup.
评论