[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] redirecting output.
From: |
Morgan Goose |
Subject: |
Re: [Fab-user] redirecting output. |
Date: |
Tue, 19 Oct 2010 01:41:26 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
If you want to capture stdout and stderr on the the cli and pipe it to a file
you can use tee like was suggested and some bash fu:
If you don't need it to display:
yourcommand &>filename
or if you do:
yourcommand 2>$1 | tee filename
http://stackoverflow.com/questions/637827/redirect-stderr-and-stdout-in-a-bash-script
goose
On Mon, Oct 18, 2010 at 10:30:22PM -0700, Nathan Brazil wrote:
> I have fabric 0.9.2 running on Ubuntu, and I want to be able to capture
> whatever is printed to the console to a file as well. So here's what I
> did:
> 1. Modify /usr/local/bin/fab's #! line to have unbuffered output, like
> so:
> #!/usr/local/bin/python -u
> 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.
> --
> On Oct 18, 2010, at 9:35 AM, Jeff Honey wrote:
>
> I've looked through the API docs and am scratching my head here. How do
> I capture Fabric's output to STDOUT and put it in a file? I know I can
> just do a simple redirection within the cmdline statement but I need to
> take that output and stick it in an email, the code for which is
> included in the function.
>
> The email code I've got just uses smtplib and pulls in a txt file.
>
> --
> ������������������
> � kyoboku kazeoshi �
> ������������������
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>
> References
>
> Visible links
> 1. mailto:address@hidden
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
---end quoted text---