This shows you the differences between two versions of the page.
|
unix:unison [2007/04/27 00:23] |
unix:unison [2007/04/27 00:23] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | !!You may edit this page!! | ||
| + | ====== Using Unison with DokuWiki ====== | ||
| + | [[http:// | ||
| + | |||
| + | I encountered several problems when I first tried to syncronise my laptop <-> desktop <-> webserver with this site. | ||
| + | |||
| + | ===== Running Unison ===== | ||
| + | I don't intend to explain how to install and use Unison itself, but I think it'd put this page in context if I were to outline how I use it. | ||
| + | |||
| + | At home I use WinXP with Cygwin((You can think of Cygwin as a "way to add the fun parts of Linux to Windows" | ||
| + | |||
| + | Script: '' | ||
| + | <code bash> | ||
| + | # | ||
| + | echo " | ||
| + | unison / | ||
| + | -fastcheck yes \ | ||
| + | -ignore 'Path downloads' | ||
| + | -ignore 'Path data/ | ||
| + | -ignore 'Path data/ | ||
| + | -ignore 'Path gallery' | ||
| + | -ignore 'Path stats' \ | ||
| + | $* # Include invocation arguments | ||
| + | </ | ||
| + | |||
| + | ==== Notes on script ==== | ||
| + | The two directories I wish to syncronise are | ||
| + | - "'' | ||
| + | - "'' | ||
| + | |||
| + | I don't bother to syncronise the cache directory, and I pass arguments from the command-line that invoked this script to unison itself via the '' | ||
| + | |||
| + | A typical run outputs something like this: | ||
| + | |||
| + | Invoked with: '' | ||
| + | < | ||
| + | Contacting server... | ||
| + | Looking for changes | ||
| + | conf/ | ||
| + | data/ | ||
| + | data/ | ||
| + | ... | ||
| + | |||
| + | Waiting for changes from server | ||
| + | Reconciling changes | ||
| + | Propagating updates | ||
| + | |||
| + | |||
| + | UNISON started propagating changes at 16:43:13 on 12 Jan 2006 | ||
| + | |||
| + | local robm | ||
| + | < | ||
| + | local : absent | ||
| + | robm : new file | ||
| + | < | ||
| + | local : absent | ||
| + | robm : new file | ||
| + | < | ||
| + | local : absent | ||
| + | ... | ||
| + | |||
| + | [BGN] Copying data/ | ||
| + | from // | ||
| + | to / | ||
| + | [BGN] Copying data/ | ||
| + | from // | ||
| + | to / | ||
| + | [BGN] Copying data/ | ||
| + | from // | ||
| + | to / | ||
| + | ... | ||
| + | |||
| + | [END] Copying data/ | ||
| + | [END] Copying data/ | ||
| + | [END] Copying data/ | ||
| + | ... | ||
| + | UNISON finished propagating changes at 16:43:23 on 12 Jan 2006 | ||
| + | |||
| + | Saving synchronizer state | ||
| + | Synchronization complete | ||
| + | </ | ||
| + | |||
| + | ===== File Permissons ===== | ||
| + | If you follow the installation instructions for DokuWiki, then you would have changed the owner of the data directory and it's subdirectories to '' | ||
| + | |||
| + | My solution to this is to change the owner of the files to me (// | ||
| + | |||
| + | ==== Changing the Owner ==== | ||
| + | <code bash> | ||
| + | find data -print0 | xargs -0 chown -v meermanr: | ||
| + | </ | ||
| + | |||
| + | This will change the owner of all file & directories under '' | ||
| + | |||
| + | Break down of this command: | ||
| + | * **find** is a command which produces a list of paths, optionally filtered by certain criteria | ||
| + | * **data** means consider only paths in ./data | ||
| + | * **-print0** means print null characters instead of spaces/ | ||
| + | * **xargs** is a command which takes a list and passes each one as an argument to the program specified. It's a convenient way to do foreach-loops and the like | ||
| + | * **-0 (zero)** tells it to use nulls to split its input into list elements | ||
| + | * **chown** Change Owner | ||
| + | * **-v** Verbose (i.e. give feedback) | ||
| + | * **meermanr: | ||
| + | |||
| + | ==== Changing the Permissions ==== | ||
| + | <code bash> | ||
| + | find data -type f -print0 | xargs -0 chmod -v ug=rw,o=r | ||
| + | find data -type d -print0 | xargs -0 chmod -v ug=rwXs, | ||
| + | </ | ||
| + | |||
| + | Similar to the previous section, this one updated the read/ | ||
| + | * **-type f/d** Means only list **f**iles or **d**irectories, | ||
| + | * **chmod** Changes access permissions of a file or directory | ||
| + | * **-v** Verbose, show what it's doing | ||
| + | * **ug=rw, | ||
| + | * **ug=rwXs, | ||
| + | * In unix, a directory' | ||
| + | * **Sticky** is not described in POSIX, but as best I can tell if a directory has the sticky bit set for the group, files created in that directory will inherit the directory' | ||
| + | |||
| + | == | ||
| + | |||
| + | I have actually scheduled both these scripts to run every hour on my server, which seems to work nicely. | ||
| + | |||
| + | ==== Side affects of wrong permissions ==== | ||
| + | I haven' | ||
| + | |||
| + | Side affects on the (Linux) webserver: | ||
| + | * File you upload to your user account will belong to you. This means that Apache cannot edit them, so all pages have a "Show Page Source" | ||
| + | * Files created by the server do not belong to you, nor do you have write permission via any other means. This means you cannot delete or modify the files directly --- you have to use DokuWiki to do that. To change the owner to yourself, you need '' | ||
| + | |||
| + | Side affects on your home (WinXP) PC: | ||
| + | * Very occasionally you get problems just like the above. But it seems you can prevent this happening by explicitly removing //all// non-inherited permissions on and within your local copy of the site (see the screen-shots below for how to do this). | ||
| + | |||
| + | ===== What about Windows? ===== | ||
| + | My desktop and laptop run WinXP Pro, and have relatively few problems with permissions, | ||
| + | |||
| + | **WinXP Home** users probably do not have to worry about this, as they do not possess the security tab for files/ | ||
| + | |||
| + | :!: //**Note:** If you have **WinXP Pro** but don't see a " | ||
| + | |||
| + | {{unix: | ||
| + | |||
| + | {{unix: | ||
| + | |||
| + | {{unix: | ||
| + | |||
| + | {{unix: | ||
| + | |||
| + | |||
| + | ===== Summary ===== | ||
| + | Now when my linux webserver creates new files, or I propagate changes to the server with unison, they are created with owner " | ||