-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added GPLv3 license * README for configuration * example for cron.daily * The script it self (owncloud-db-backup.sh)
- Loading branch information
0 parents
commit 04f96ec
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Copyright 2015 Fredrik Mikker <[email protected]> | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Simple script to do a local database backup of a owncloud instance, to be fetched later by the system backup (In this case Bacula). | ||
|
||
Intended for a Owncloud instance running in CentOS 7 with systemd, which utilizes the internal journal instead of log files by pipe-ing to systemd-cat, which is sent to a central syslog server (op5 Logger). | ||
|
||
Usage: | ||
|
||
1. Copy owncloud-db-backup.sh to a suitable folder for binaries (/root/bin/ in my case) | ||
1.2: Change the settings in the script to correspond to your user, password and database name. | ||
2. Use the cron file supplied and put it in /etc/cron.daily/ | ||
3. Test the functinality by using run-parts: | ||
# run-parts /etc/cron.daily/ -v | ||
4. Monitor your system journal to confirm that the log messages is written: | ||
# journalctl -f |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
/root/bin/owncloud-db-backup.sh 2>&1 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
mysqldump --lock-tables -u <INSERT USERNAME> -p<INSERT PASSWORD> owncloud_data > /owncloud/backup/owncloud-sqlbkp_`date +"%Y%m%d"`.bak | ||
|
||
if [ $? -eq 0 ] | ||
|
||
then | ||
|
||
echo "Owncloud database backup successful" | systemd-cat --identifier "owncloud-db-backup" --priority "info" | ||
|
||
exit 0 | ||
|
||
else | ||
|
||
echo "Owncloud database backup failed!" | systemd-cat --identifier "owncloud-db-backup" --priority "warn" | ||
|
||
exit 1 | ||
|
||
fi |