I have a @daily
job in the crontab that runs git gc
on all the repos.
I'm trying to set up a log file for the job but I/O redirection does not produce the results I am looking for; I get a blank file.
I've done all the usual >
, 2>&1
and so on without any success.
Someone mentioned to me that git gc
uses ncurses for its output procedures which throws output directly to the console, thus bypassing stdout/stderr (correct me if I'm wrong here).
Can some one point me in the right direction?
You can try this:
script -q -c 'git gc' > log
Or this (with more readable output):
script -q -c 'git gc' | sed 's/\r.*//g' > log