Created
March 10, 2010 05:46
-
-
Save whiteley/327566 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nohup(/tmp)% cat backup.sh | |
#!/bin/bash | |
echo "almost done" | |
echo "omg error" >&2 | |
nohup(/tmp)% cat tng.py | |
#!/usr/bin/env python | |
from subprocess import * | |
import sys | |
logfile = open('backup.log', 'w') | |
p = Popen('./backup.sh', shell=True, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) | |
for line in p.stdout.readlines(): | |
logfile.write(line) | |
for line in p.stderr.readlines(): | |
logfile.write(line) | |
sys.stderr.write(line) | |
nohup(/tmp)% ./tng.py | |
omg error | |
nohup(/tmp)% cat backup.log | |
almost done | |
omg error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment