Install and Configure HotelDruid on Your Local Computer as a Hosting Backup
Follow these instructions to set up a working backup copy of HotelDruid on your computer, taking the data
from your DigitalDruid.Net hosting. This can be useful in case you temporarily loose your internet connection,
as for backup purposes you already have the files of the last 30 days on your DigitalDruid.Net hosting account.
Please note that some technical expertise is needed to follow this tutorial and that the local copy does not
fall under the competences of the DigitalDruid.Net hosting support.
First of all you have to download the latest release of HotelDruid from the download page. To install it on Windows you can follow the instructions from the "Windows install" tutorial. On linux you should be able to install apache, php and mysql with the package manager from your distribution, and then follow instructions in the README file, found in the HotelDruid "doc" directory, to create a mysql user and install HotelDruid. Going on with the install, choose any number of apartments/rooms and create current year. Then on this newly installed copy of HotelDruid go to the interconnections page ("main menu" --> "configure and customize" --> "interconnections") and put as the URL for subordination this one:
replacing XXX with your hosting number. Below it put the username and password of the administrator user on the hosting (or, better, choose a user on the hosting that has in his privileges the ability to create backupps). Then create the subordination (the computer needs to be connected to the Internet when creating or updating the subordination). Now all data will be copied from the hosting, so the next time you access HotelDruid on your computer you'll have to use the same usernames and passwords you have on the hosting. Once you have made the login on your computer you'll see the button to update the data from the hosting on the upper-left in main menu, and you won't be able to make any changes to reservations (to avoid making changes by mistake on your computer instead of the hosting, as these changes would by overwritten the next time you update the data).
To automate the updates, firstly you have to go, as administrator, to the interconnections page on the hosting and on the first row select the "User to remotely update interconnections" (if not already selected), this user must have the password enabled but needs no privileges. Then go again to HotelDruid on your computer and update the data from the hosting. So now, supposing that you have installed HotelDruid in the "hoteldruid" directory, you will be able to update the copy on your computer each time you open, from that same computer, this page:
replacing UNAME and PASSWD with the username and password of the user you selected for interconnections.
On linux you can use a cron job to hit this URL each night. So you can edit you crontab file (for example open a terminal and enter "crontab -e") and add this line:
40 5 * * * wget -O /dev/null "http://localhost/hoteldruid/interconnessioni.php?user=UNAME&password=PASSWD"
replacing again UNAME and PASSWD, this will update the local database each day at 5:40 (if the computer is on and connected to the Internet). For this to work you have also to check, with your package manager, that the "wget" package is installed.
Finally, to make sure that the copy on you computer gets updated when a new HotelDruid version comes out, you have to delete the file NO_SOURCE_CODE_UPDATE in the HotelDruid directory and make sure that all the HotelDruid files and directories can be overwritten by the web server. For example, on Ubuntu or other Debian derived linux distributions, these files and directories must be owned by the "www-data" user.