git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Silent maintenance

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Aug 14, 2010, 21:41 UTC
Message-ID
<AANLkTimLHand0g965TJmk=Y4Q+0uTFovZZRZXf9Fx4UB@mail.gmail.com>
In-Reply-To
<20100814210556.GB2372@burratino>
On Sat, Aug 14, 2010 at 21:05, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 6 quoted lines
> Enrico Weigelt wrote:
>
>> are there some flags to make the maintenance commands like
>> git-repack and git-gc silent, so they only output errors ?
>
> Does --quiet work?  If not, patches would be welcome.

I intentionally neglected to mention that. That inevitably leads to cases where something fails, but you didn't record the output.

Instead (copy/paste from a recent post of mine to an unrelated mailing list, funny how these things come up at the same time), do:

Just install this: http://search.cpan.org/dist/App-Cronjob/
Then put something like this in your crontab:
   @daily cronjob -E -j josm-build -E /path/to/build.sh

cronjob(1) will consume all the output, and either print it all or nothing, depending on the exit code of the program it's running.

If you're running a POSIX shell script you can add this to the top of the script:

   # Exit on errors
   trap 'fail' ERR
   fail () {
       code=$?
       echo "Failed with exit code $code"
       exit 1
   }
Then you don't have to check the exit code of everything individually.

I use this for all my cronjobs, see e.g. http://github.com/avar/openstreetmap-mirror for an example, it's what I use to get E-Mails when the JOSM GitHub mirror fails, but *only* when it fails.

Previous: Jonathan NiederNext: Jeff King
Message 6 of 9 in “Silent maintenance”
  1. Enrico WeigeltAug 14, 2010
  2. Ævar Arnfjörð BjarmasonAug 14, 2010
  3. Valeo de VriesAug 14, 2010
  4. Ævar Arnfjörð BjarmasonAug 14, 2010
  5. Jonathan NiederAug 14, 2010
  6. Ævar Arnfjörð BjarmasonAug 14, 2010
  7. Jeff KingAug 14, 2010
  8. Ævar Arnfjörð BjarmasonAug 15, 2010
  9. Enrico WeigeltAug 15, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.