Automated Hoteldruid Backups?

Discuss here how to configure hoteldruid and better use its features.

Moderator: marco

Post Reply
clayhawks
Posts: 1
Joined: Tue Jul 15, 2014 1:01 pm

Automated Hoteldruid Backups?

Post by clayhawks »

Marco, I've installed this wonderful system you've developed and I thank you. Do you know of a way to run backups in an automated way? In the web interface I can obviously push the "Create a New Backup File" button and get a valid backup file. I have done so and have been able to successfully restore the data to a backup server. I would like to be able to script the backup in such a way that it happens without user interaction and on a schedule.

Thanks again!
marco
Posts: 1332
Joined: Tue Jul 05, 2005 6:00 pm
Location: Roma, Italia

Re: Automated Hoteldruid Backups?

Post by marco »

It depends on your system which tools you can use to periodically call an URL (cron job with wget, etc.) and there other forums over the Internet where it's more appropriate to discuss this. For what concerns hoteldruid the URLs that must be called to create and download the backup are:

http://yourdomain.com/hoteldruid_path/c ... _backup=SI

http://yourdomain.com/hoteldruid_path/c ... _backup=SI

where you must replace $USER and $PASS whit the username and password of an hoteldruid user that is able to create backups and $YEAR with current hoteldruid year.

Regards,
Marco
Problems installing, configuring, upgrading?
Try the easiest way to use HotelDruid:
https://www.digitaldruid.net/hosted/index.php
clayton256
Posts: 15
Joined: Mon Jan 28, 2013 9:02 pm
Location: Lehighton, PA, USA

Re: Automated Hoteldruid Backups?

Post by clayton256 »

Hi Marco,

Should this approach to automated backups still work with version 2.1.4? I tried a couple of wget calls in a bash script substituting real values for the variables as such:

Code: Select all

#! /bin/bash

USER=backup
PASS=secrets
YEAR=2017

wget http://lizzy.local./hoteldruid/crea_backup.php?nome_utente_phpr=$USER&password_phpr=$PASS&anno=$YEAR&crea_backup=SI
wget http://lizzy.local./hoteldruid/crea_backup.php?nome_utente_phpr=$USER&password_phpr=$PASS&anno=$YEAR&mostra_header=NO&salva_backup=SI
The wget calls download files called: crea_backup.php?nome_utente_phpr=backup, crea_backup.php?nome_utente_phpr=backup.1, crea_backup.php?nome_utente_phpr=backup.2... But never cause a hoteld_backup.php file to be created. I do see a hoteld_backup.php.lock file if that is useful info.

Where should I start to investigate what is going wrong?

Thanks for any help you can offer!

Mark Clayton
--
http://www.LizardCreekPA.com
Matteo46
Posts: 10
Joined: Tue Sep 11, 2012 1:28 pm

Re: Automated Hoteldruid Backups?

Post by Matteo46 »

Hi clayton256,
I wrote this script for my backups, it use mysqldump for the database, tar for the file and then this script https://github.com/andreafabrizi/Dropbox-Uploader to upload all in dropbox. The backups will be organized in folder like HD-YEAR-MONTH and inside the backups of each days (you can use a cronjob each night). When the space is full you can easily delete from dropbox entire month with just 1 click.

Hope it can help you.

Code: Select all

#!/bin/bash

td=tmpbackup

giorno=$(date +%d)
file=hd-$(date +%Y_%m_%d-%H_%M)
cart=$(date +%Y_%m)

/usr/bin/mysqldump -u USER -pPASSWD NAME_DB > $td/$file.sql
tar czfP $td/$file.tgz domains/yoursite.com/public_html/hoteldruid $td/$file.sql

./dropbox_uploader.sh upload $td/$file.tgz /hd-$cart/$giorno/$file.tgz

rm $td/$file.tgz
rm $td/$file.sql
clayton256
Posts: 15
Joined: Mon Jan 28, 2013 9:02 pm
Location: Lehighton, PA, USA

Re: Automated Hoteldruid Backups?

Post by clayton256 »

Hi Matteo46,

Thanks for your reply. Sorry I didn't see your reply until now. I thought I would get an notification on this thread but I didn't.

I went down this same path before I heard about the builtin backup/restore feature. Ultimately, I'm trying to build a link
between two installs to push changes instead of the builtin's pull mechanism.

Thanks again,
Mark
Matteo46 wrote:Hi clayton256,
I wrote this script for my backups, it use mysqldump for the database, tar for the file and then this script https://github.com/andreafabrizi/Dropbox-Uploader to upload all in dropbox. The backups will be organized in folder like HD-YEAR-MONTH and inside the backups of each days (you can use a cronjob each night). When the space is full you can easily delete from dropbox entire month with just 1 click.

Hope it can help you.

Code: Select all

#!/bin/bash

td=tmpbackup

giorno=$(date +%d)
file=hd-$(date +%Y_%m_%d-%H_%M)
cart=$(date +%Y_%m)

/usr/bin/mysqldump -u USER -pPASSWD NAME_DB > $td/$file.sql
tar czfP $td/$file.tgz domains/yoursite.com/public_html/hoteldruid $td/$file.sql

./dropbox_uploader.sh upload $td/$file.tgz /hd-$cart/$giorno/$file.tgz

rm $td/$file.tgz
rm $td/$file.sql
--
http://www.LizardCreekPA.com
Matteo46
Posts: 10
Joined: Tue Sep 11, 2012 1:28 pm

Re: Automated Hoteldruid Backups?

Post by Matteo46 »

Two backups are better than one :mrgreen:
marco
Posts: 1332
Joined: Tue Jul 05, 2005 6:00 pm
Location: Roma, Italia

Re: Automated Hoteldruid Backups?

Post by marco »

Hello Mark,
try to use quotes around wget urls. Also the urls are a little wierd (maybe you want to replace "lizzy.local." with "localhost"?).
clayton256 wrote: The wget calls download files called: crea_backup.php?nome_utente_phpr=backup, crea_backup.php?nome_utente_phpr=backup.1, crea_backup.php?nome_utente_phpr=backup.2... But never cause a hoteld_backup.php file to be created. I do see a hoteld_backup.php.lock file if that is useful info.
can you check what these files contain?

Regards,
Marco
Problems installing, configuring, upgrading?
Try the easiest way to use HotelDruid:
https://www.digitaldruid.net/hosted/index.php
nethead
Posts: 18
Joined: Thu Jan 06, 2011 7:48 am

Re: Automated Hoteldruid Backups?

Post by nethead »

Hi,

the URI's youve posted bring you to the backup interface of hoteldruid but they dont start the download.

Is there any URL parameter to immediatly start the download? Otherwise its not usuable via cron/wget.

cheers,

Arnd
marco
Posts: 1332
Joined: Tue Jul 05, 2005 6:00 pm
Location: Roma, Italia

Re: Automated Hoteldruid Backups?

Post by marco »

Hello Arnd,
that's why there are 2 URLs in my original post, one to create the backup and the other to download it.

Regards,
Marco
Problems installing, configuring, upgrading?
Try the easiest way to use HotelDruid:
https://www.digitaldruid.net/hosted/index.php
Post Reply