I've just knocked out a quick script for keeping a slave web server in sync with a master using rsync. (https://github.com/simonjgreen/liveFolderSync/blob/master/liveFolderSync.sh)
I'd like to make this run on boot and be controllable via the usual /etc/init.d/... or service commands, however this is an area I've always fallen down in. I find both init.d scripts and upstart scripts horrendously confusing, and can't find a guide anywhere for starting from scratch.
The only control I'd like to have over it is start/stop/restart. Obviously later I will move the config into a separate file in /etc but that's already on the cards so outside the scope of this question.
Any pointers/advise and best practices would be helpful. I should add that I'm doing this on Ubuntu.
To get started with Sys V init scripts, I suggest the following links:
For instructions specific to Upstart, I would recommend starting with:
At present, there are also 129 questions on AskUbuntu, several of which will point you in the right direction: