I have a bash script, /home/x/bin/asdf, (which fires up a bunch of JVMs, piped together), and that works fine, when running directly from the command line like


However, when trying to run the same as

echo '/home/x/bin/asdf' | at SOME_TIME

Then I can see that the script and my JVMs start, but they terminate after one second or so. The initial output of those JVMs will indeed be sent by at in its email with the stdout, so it is working - briefly.

So why would the asdf script / the JVMs get terminated almost immediately? When running directly, it runs and outputs stuff indefinitely.

N.B. One of the JVMs makes a TCP connection. I cannot confirm that that is done when run by at. But if there's an error, it will be printed to stderr. But in at's email there is no error.

1 Answer 1


So the crucial difference between starting the script directly and having at run it was: the lack of stdin in the latter case.

So I can reproduce my script immediately shutting down by doing this:

/home/x/bin/asdf </dev/null

To fix it, I had to change one of those Java programs, which terminated when there was no input from stdin.

  • You might also want to redirect stderr to stdout: 2>&1 Commented Sep 26, 2018 at 13:53
  • @glennjackman why? Commented Sep 28, 2018 at 0:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .