Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have added a git pull & to my bashrc to keep a particular project always up to date!

However this means every time I open a terminal I get a message like

[17]+ Running git pull

And a few seconds later

[17] Done

Is there a way to stop this output? I'm already sending all output to dev null so the full command is git pull >/dev/null 2>&1 &

share|improve this question

3 Answers 3

up vote 2 down vote accepted

The messages on screen are the result of backgrounding the job, not the job itself.

Try this:

#!/bin/bash

exec &> /dev/null
git pull

In this variant, the process backgrounding the job is a script that already redirects all output.

Of course, such a command should really go in your bash_login, or in your .profile, not in .bashrc.

share|improve this answer

You could use at(1) or even batch(1) to start your command:

echo git pull | at now 2>/dev/null

This way it would also not receive a SIGHUP if you log out immediately. The 2>/dev/null prevents the message job 1334584295.a at Mon Apr 16 15:51:35 2012 to be written by the at command.

You may have to add your user name to /usr/lib/cron/at.allow (location of this file may differ with our flavour of UNIX/Linux).

share|improve this answer

I found that using a subshell silences the backgrounding of the job:

(git pull &)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.