Page 1 of 1

Backup of files and database

PostPosted:Tue Jul 22, 2014 12:31 am
by matt81
Hu Guys,
I need to know what is the best way to do backup of files and database in Openkm. I found the following link http://wiki.openkm.com/index.php/Backup_with_rsync.
It has good scripts, can I use them on the Cron tab in Openkm, so it does it automatically?

Do you have any suggestions.

Thanks

Re: Backup of files and database

PostPosted:Thu Jul 24, 2014 4:14 pm
by jllort
Yes, you can use with a crontab ( for example with http://wiki.openkm.com/index.php/Backup ... iff-backup or http://wiki.openkm.com/index.php/Backup_with_duplicity you can generate incremetal backups )

Re: Backup of files and database

PostPosted:Fri Aug 01, 2014 2:23 am
by matt81
Thanks for your reply.
I did try using the Duplicity script named "Remote backup with duplicity (Tomcat - MySQL) " in
http://wiki.openkm.com/index.php/Backup_with_duplicity

However when I execute from Cron tab I receive the following error via email:
Code: Select all
Sourced file: inline evaluation of: ``#!/bin/bash ## BEGIN CONFIG ## HOST=$(uname -n) MYSQL_PASS="PBR58Iff" OPENKM_DB= . . . '' Token Parsing Error: Lexical error at line 2, column 2. Encountered: "#" (35), after : "#":


Thanks

Re: Backup of files and database

PostPosted:Sun Aug 03, 2014 9:18 am
by jllort
Quite strange, it seems that not done break lines correctly when you copied the script, take a look on it. If you're executing on Linux I suggest do not write files on Windows and then copy on lines, break lines codes are not the same and could be some problem. Take a look at file on Linux and be sure is right composed.

Re: Backup of files and database

PostPosted:Mon Aug 04, 2014 11:55 pm
by matt81
Thanks for your reply.
It is very strange indeed, I did copy the script from my Ubuntu 12.04 version, and I still received the error. I then removed the first three lines of code
Code: Select all
#!/bin/bash
#
## BEGIN CONFIG ##
, and it didn't throw that error any more, however it started to throw other errors.
I then started receiving the following error
Code: Select all
Parse error at line 2, column 1. Encountered: MYSQL_PASS 
I then tried to place a semi colon ; at the end of line 1 and line 2, see below:
Code: Select all
HOST=$(uname -n);
MYSQL_PASS="";
However I then received the following error:
Code: Select all
Sourced file: inline evaluation of: ``HOST=$(uname -n); MYSQL_PASS=""; OPENKM_DB="okmdb" OPENKM_HOME="/home/openkm" TO . . . '' : illegal use of undefined variable, class, or 'void' literal : at Line: 1 : in file: inline evaluation of: ``HOST=$(uname -n); MYSQL_PASS=""; OPENKM_DB="okmdb" OPENKM_HOME="/home/openkm" TO . . . '' : ) ; 
So this script is throwing errors, either I am doing something worng or this script doesn't work for Ubuntu 12.04 version. I save the file as .bsh extension as that is the only extension OpenKM accepts in order for the script to execute.

Thanks

Re: Backup of files and database

PostPosted:Wed Aug 06, 2014 2:03 am
by matt81
Just an update, I tried to execute the script from Ubuntu's terminal, and it works prefectctly fine, it did a backup of the database and all of OpenKM's files.
Do you know why it doesn't work properly from OpenKM cron tab.

Thanks

Re: Backup of files and database

PostPosted:Fri Aug 08, 2014 5:40 pm
by jllort
Sincerally no. I suggest you use root user to schedule crontab, not openkm user. Here could be the problem.