[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] redirecting output.
From: |
John Eikenberry |
Subject: |
Re: [Fab-user] redirecting output. |
Date: |
Tue, 19 Oct 2010 14:29:37 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
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
address@hidden - 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
signature.asc
Description: Digital signature