PmWiki is a popular wiki software which uses the file system to store wiki pages. è un noto software wiki che utilizza il file system per memorizzare pagine wiki. We use for our intranet and to document our processes and systems. Noi utilizziamo per la nostra Intranet e di documentare i nostri processi e sistemi. One of my rising concerns was that it wasn’t backed up at all. Una delle mie preoccupazioni in aumento è stato che non è stato eseguito il backup a tutti. So I came up with a simple script to backup pmwiki regularly to our Subversion repository. Così sono arrivato fino a un semplice script di backup PmWiki regolarmente al nostro deposito Subversion. There are two ways in which this can be done. Ci sono due modi in cui questo può essere fatto. The ideal way is to automatically add files and commit changes whenever a change is made. Il modo ideale è quello di aggiungere automaticamente i file e le modifiche commettere ogni volta che un cambiamento è fatto. The second way is to use a cron job to periodically add new files and commit the changes to the subversion repository. Il secondo modo è quello di usare un job di cron periodicamente per aggiungere nuovi file e le modifiche al deposito di sovversione. Let’s look at both of the options and explore the simpler one in details. Diamo un'occhiata ad entrambe le opzioni ed esplorare il più semplice uno in dettagli.

As mentioned before the ideal solution is to automatically add files and commit changes whenever a change is made. Come già accennato la soluzione ideale è quella di aggiungere automaticamente i file e le modifiche commettere ogni volta che un cambiamento è fatto. To setup this you need to use Apache to serve the repository through WebDAV interface. Per configurare questo è necessario utilizzare Apache per servire il repository tramite interfaccia WebDAV. Then the WebDAV filesystem has to be mounted on your /var/www/html or htdocs directory (as appropriate). WebDAV quindi il filesystem deve essere montato sul tuo / var / www / htdocs html o directory (a seconda dei casi). This will allow changes in the wiki (which is effectively adding / changing files under wiki.d directory) to be automated added, as necessary, and commited to your subversion repository. Ciò consentirà di cambiamenti nel wiki (che è effettivamente l'aggiunta / modifica file sotto wiki.d directory) per essere automatizzati aggiunto, come necessario, e il vostro impegno a deposito di sovversione. This magic happens because Subversion Apache module supports limited amount, enough for this job, of DeltaAV functionality. Questo accade perché la magia di sovversione Apache modulo supporta quantità limitata, abbastanza per questo lavoro, di DeltaAV funzionalità.

I opted for a simpler solution. Ho optato per una soluzione più semplice. First I created a repository and checked in my pmwiki directory. Per prima cosa ho creato un repository e controllati nel mio PmWiki directory. Then I created an update script in the same directory to add new files and commit changes when invoked. Quindi ho creato un aggiornamento di script nella stessa directory di aggiungere nuovi file e le modifiche commettere quando invocato. I checked in this script too. Ho verificato in questo script. The code is: Il codice è:

 #!/bin/bash cd /var/www/html/wiki/ svn -q add * svn -q add wiki.d/* svn commit -m "Wiki Updates" #! / bin / bash cd / var / www / html / wiki / svn-q * aggiungere svn-q aggiungere wiki.d / * svn commit-m "Wiki Aggiornamenti" 

This is a very simple script which blindly adds new files and commits changes. Si tratta di un semplice script che ciecamente aggiunge nuovi file e impegna i cambiamenti. Now we just have to invoke it regularly. Ora basta invocare regolarmente. I invoked “crontab -e” to edit my cron file. Ho invocato "crontab-e" per modificare il mio file di cron. Here is the one-liner I use to run the script once an hour: Qui è la sola linea che utilizzo per eseguire lo script una volta ogni ora:
1 * * * * /var/www/html/wiki/update 1 * * * * / var / www / html / wiki / aggiornamento

Everything is working like a charm. Tutto funziona come un fascino.