[Koha] How to run cron to autobackup of koha database (only sql) ?
Fridolin SOMERS
fridolin.somers at biblibre.com
Thu Sep 22 00:37:45 NZST 2016
Hie,
I advice you to store user and password for mysql in ~/.my.cnf.
So you can simply call as koha user : mysqldump dbname > ...
Example :
[client]
user=kohaadmin
password=katikoan
host=localhost
[mysql]
default-character-set=utf8
database=kohadb
In this case mysql leads to a connexion with kohadb selected.
Not possible for mysqldump, db name must be specified.
Regards,
Le 21/09/2016 à 14:01, Barton Chittenden a écrit :
> 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).
> _______________________________________________
> Koha mailing list http://koha-community.org
> Koha at lists.katipo.co.nz
> https://lists.katipo.co.nz/mailman/listinfo/koha
>
--
Fridolin SOMERS
Biblibre - Pôles support et système
fridolin.somers at biblibre.com
More information about the Koha
mailing list