Nathan Brazil wrote:

> 2. Create a shell script named myfab that goes something like this:
> 
>       #!/usr/bin/env bash
>       fab $* | tee log/`date +%FT%Hh%Mm%Ss`.log
> 
> Now, whenever I run myfab instead of fab, the output is shown on
> screen as well as captured in a timestamped log file.
> 
> However, there is a drawback in that stderr is not captured, such
> that if my fab script bombs out, the error message is absent from
> the log file.  This is acceptable for now, though, since deployments
> are to be automated, but not unattended, IMHO.

To get both stdout and stderr do this...

fab "$@" 2>&1 | tee log/`date +%FT%Hh%Mm%Ss`.log

Note that "$@" tends to work better in most cases than $*, at least in terms of
getting quoting right.

-- 

John Eikenberry
[[email protected] - http://zhar.net]
[PGP public key @ http://zhar.net/jae_at_zhar_net.gpg]
______________________________________________________________
"Perfection is attained, not when no more can be added, but when no more 
 can be removed." -- Antoine de Saint-Exupery

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Fab-user mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to