Normally I use a command like
history > ~/tmp/hh to save a history file. Then I use
vi, jump to the bottom with the G command and then search upwards until I find the part that would be near a useful entry point into a script. From there I collapse out extraneous
ls commands, combine series of incremental
cd into directories, add comments, and start figuring out which parts need to be arguments, which things might have to be environment settings and which things have to be hard-coded. I add lots of comments. Sometimes I "punt" on parts of automating it and just give the user some instructions (go find this setting,
ssh to foo and ..., uncomment blah from this file and move it to blarg) or
echo a URL ... and a prompt string like: 'Configured Foo and exit >'
(When you punt on an automated file edit ... I suggest appending the instructive code to the file, as a comment, and use something like the
vi + command line switch to put the editor's cursor near the bottom of the file, at the top of your instructions. For example with 5 lines of instructive text (a here doc for example) you'd add
'+$-5' to the
vi command line, before the filename. (
$-5 is an old
ex incantation to address the last line of the file, minus five lines; the relatively obscure
+ switch to
vi accepts any
ex ... : command ... as an argument).
Another trick ... assuming you do most of your work from a X Windowing System terminal (
gnome-terminal, etc) then keep a browser open on some wiki pages as you go. Cut and past commands, output, snippets of text files and jot down notes as you go. (This mostly assumes you're mostly working on your servers over
ssh from your workstation, desktop, laptop, or whatever).
Save early and often.
Create new wiki pages for different processes or stages. Then link them together and link out to any references out on the 'net. (You know, all those Google pages you used every time you got stuck at any point).
Some of my best HOWTO documents have been created this way.
If you do it right then you might be able to get the job off your plate the old-fashioned way, by delegating to the junior team member ... or the eager intern. :)