[Koha] How to run cron to autobackup of koha database (only sql) ?

Barton Chittenden barton at bywatersolutions.com
Thu Sep 22 00:01:00 NZST 2016


On Sep 19, 2016 10:37 PM, "SATISH" <lis4satish at gmail.com> wrote:

> I wanted to autobackup of koha db (example: at 5:15 pm daily before
library
> closes)
> I tried with, following steps.
>
> 1. added in crontab -e
> #ADDED BY SATISH FOR DAILY BACKUP AT 5.15 PM DAILY
> 15 17 * * *  mysqldump -uroot -pmysqlrootpassword dbname | gzip -9 >
> /home/satish/Dropbox/dbname.sql.gz
>
> When I check the dbsize, it is "zero". Therefore, It is not working!
>

The mysqldump syntax looks correct.

What user are you running the crontab under?

My inclination would be to run the backup under the instance user, using
the database user in $KOHA_CONF.

Crontabs can get picky about things like $PATH being undefined, so you may
need to specify the full path of mysqldump. Also, they look like they use
shell syntax, but you should consult 'man 8 crontab' for differences.

I'm on my phone, so I can't look up the exact syntax that I use for
inserting timestamps into file names, or how that interacts with crontab. I
can tell you that I use 'date' in back-ticks, but I'm not sure which
arguments I used, whether crontab supports back-ticks (if not, just wrap
your call to mysqldump inside a small shell script, and call the script
from the crontab).


More information about the Koha mailing list