This is a simple script for syncing Unison profiles. Basically, given a list of profiles (which must already be created in Unison), it will sync all files with non-conflicting states. It logs the time of start and completion to unison.log
(change OUTPUT=$HOME/unison.log
if you want it to output somewhere else), as well as listing the output Unison gives for each sync. Unison already knows the hosts to sync, because that's recorded by Unison in the profiles it stores in ~/.unison
. And you'll need SSH keys already setup.
If you want to automate this script in Ubuntu, search the dash for "Startup Applications" and open it up, then click on "add" in the window that opens. You'll be prompted for a name and command. Name it anything you like and make the command the path to the script, e.g. ~/scripts/unison_sync.sh
. Now it will run every time you login.
Rest assured I have no idea what I'm doing. This is literally my first bash script, and it comes with ABSOLUTELY NO WARRANTY WHATSOEVER! It's experimental and may do anything it wants including, but not limited to, making loud chewing noises in its sleep or making rude comments about your breath. USE AT YOUR OWN RISK!
Feel free to leave feedback or questions (which I probably can't answer) below. If you have a question along the lines of "Why did you write the script like this," then you probably forgot to read the disclaimer!