Changes

From Amahi Wiki
Jump to: navigation, search
no edit summary
image =oc_tip.png|
heading =ownCloud Tip!|
message = Before going further please become acquainted with the ''[[Rsnapshot|"rsnapshot"]]'' Wiki article.}}
<!--ownCloud Tip ends-->
=== Key Directories ===
* Enter the following on the command-line to initiate the test.
<blockquote>{{Code| rsnapshot configtest}}</blockquote>
* When the test completes the following should be displayed:
<blockquote>{{Text|Text= Syntax OK}}</blockquote>
* If an error occurs the rsnapshot configuration file will need to be checked.
=== Backup ===
* The following command-line entry will perform the backup:
<blockquote>{{Code| rsnapshot daily}}</blockquote>
* The first time that rsnapshot runs could take sometime, each subsequent run should be quicker (depending on data changes).
* The following directories are created over time under the "backups" directory:
 <blockquotepre>{{Text|Text=drwxr-xr-x 3 root root 4096 Feb 15 01:30 daily.0
drwxr-xr-x 3 root root 4096 Feb 14 01:30 daily.1
drwxr-xr-x 3 root root 4096 Feb 13 01:30 daily.2
drwxr-xr-x 3 root root 4096 Feb 10 01:30 daily.5
drwxr-xr-x 3 root root 4096 Feb 9 01:30 daily.6
drwxr-xr-x 2 root root 4096 Jan 20 09:38 logs}}</blockquotepre
* As mentioned before, notice that the "daily.0" directory is the most recent backup version.
* Restore the ownCloud "config.php" file from the most recent backups with the following:
<blockquote>{{Code| rsync -avr --delete /var/hda/backups/daily.0/owncloud/var/hda/web-apps/owncloud/html/config/config.php /var/hda/web-apps/owncloud/html/config/}}</blockquote>
* Restore the ownCloud "apps" directory from the most recent backups with the following:
<blockquotepre style="white-space: pre-wrap; word-break: keep-all;">{{Code|rsync -avr --delete /var/hda/backups/daily.0/owncloud/var/hda/web-apps/owncloud/html/apps /var/hda/web-apps/owncloud/html/}}</blockquotepre>
* Restore the ownCloud database from the most recent backups using the database dump file:
:1. Recreate the database ('''THIS IS EXTREMELY IMPORTANT'''):
<blockquote>{{Code| mysqladmin -uowncloud -powncloud -f drop owncloud; mysqladmin -uowncloud -powncloud -f create owncloud;}}</blockquote>
:2. Restore the database:
<blockquotepre style="white-space: pre-wrap; word-break: keep-all;">{{Code|mysql -u owncloud -powncloud owncloud < /var/hda/backups/daily.0/owncloud/database_dump/owncloud_db.sql}}</blockquotepre
* Login to ownCloud using a normal user ID and test ownCloud functionality (i.e. sharing) and applications.
* If the prior testing was successful have other users test their ownCloud IDs.
* The restore of ownCloud is now completed.
 
* Before doing the "files" restore make sure that there is enough disk storage room.
* Enter the following "rsync" command to restore the "files" directory from the most recent backups. Depending on the amount of data stored the restore could take sometime.
<blockquote>{{Code| rsync -avr --delete /var/hda/backups/daily.0/owncloud/var/hda/files /var/hda/}}</blockquote>
image =oc_tip.png|
heading =ownCloud Tip!|
message = Before going further please become acquainted with the ''[[Upgrading ownCloud to New Version Releases|Upgrading ownCloud to New Version Releases]]'' Wiki article.}} <!--ownCloud Tip ends-->
===== Update =====
* Restore the ownCloud "config.php" file from the most recent backups with the following:
<blockquote>{{Code| rsync -avr --delete /var/hda/backups/daily.0/owncloud/var/hda/web-apps/owncloud/html/config/config.php /var/hda/web-apps/owncloud/html/config/}}</blockquote>
* Restore the ownCloud "apps" directory from the most recent backups with the following:
<blockquotepre style="white-space: pre-wrap; word-break: keep-all;">{{Code|rsync -avr --delete /var/hda/backups/daily.0/owncloud/var/hda/web-apps/owncloud/html/apps /var/hda/web-apps/owncloud/html/}}</blockquotepre>
* The following command-line entry will restore the ownCloud database from the most recent backups:
<blockquote>{{Code| mysql -u owncloud -powncloud owncloud < /var/hda/backups/daily.0/owncloud/database_dump/owncloud_db.sql}}</blockquote>
* Restore the ownCloud "config.php" file from the most recent backups with the following:
<blockquote>{{Code| ​rsync -avr --delete /var/hda/backups/daily.0/owncloud/var/hda/web-apps/owncloud/html/config/config.php /var/hda/web-apps/owncloud/html/config/}}</blockquote>
* The following command-line entry will restore the ownCloud database from the most recent backups:
<blockquote>{{Code| mysql -u owncloud -powncloud owncloud < /var/hda/backups/daily.0/owncloud/database_dump/owncloud_db.sql}}</blockquote>
* A "root" user "cron job" could be created to perform backups at say "1:30 AM" everyday.
<blockquote>root user "crontab" configuration:{{Text|Text= 30 01 * * * /usr/bin/rsnapshot daily}}</blockquote>
* Some system administrators will create a "nighttime backup script" cron job that is executed at say "1:30 AM" before a server is shutdown each night.
<blockquote>root user "crontab" configuration:{{Text|Text= 30 01 * * * /root/scripts/nighttime.bash}}</blockquote>
<blockquote>root user "nighttime.bash" script:{{Code|<pre>nighttime.bash
#!/bin/bash
# Night time operations: Backup and Shutdown
wall -n "$(date +%A) @ $(date +%T) system shutting down at scheduled time."
# Shutdown System
/sbin/shutdown -h now}}</blockquotepre>
=== Amahi ownCloud Backup/Recovery Tools ===
The backup tool is called,"oc-backup.sh". Currently it is configured to only do an "rsnapshot daily". The tool is run using the "root" user ID in a "terminal session".
<blockquote>Help information is available by:{{Code| /var/hda/web-apps/owncloud/html/scripts/oc-backup.sh -h}}</blockquote>
<blockquote>Resulting in the following:{{Text|Text=<pre>Usage: oc-backup.sh [option]
Options:
-h help
--version displays version of this script
-d do daily backup}}</blockquotepre>
The tool only allows one command-line option to be entered. Please note the "-d" option? This performs the daily backup process.
The backup tool is called, "oc-recover.sh". The recovery tool performs several different types of ownCloud recovery operations.
<blockquote>Help information is available by:{{Code| /var/hda/web-apps/owncloud/html/scripts/oc-recover.sh -h}}</blockquote>
<blockquote>Resulting in the following:{{Text|Text=<pre>Usage: oc-recover.sh [option]
Options:
-pf or -fp update ownCloud and ownCloud data files
-gf or -fg upgrade ownCloud and ownCloud data files
--version displays version of this script}}</blockquotepre>
The tool only allows one command-line option to be entered.
12,424

edits