Understanding root in batch/background mode


After following the instruction i tried to run a macro in background mode

My command

Though this works, it still makes the terminal unusable, its something like running interactively, except now the display messages are piped to ‘test.log’. And also i cannot log out of the machine, if i did the job fails, which defies the purpose.

As my macro will run for couple of hours, i am looking for running it in batch mode where even if i log out or any internet glitch problem should not affect the running job!

Try this way (note the extra ‘&’): root -b -q 'test24_1.C("D","16")' >& test.log &
Cheers, Bertrand.


I tried it, but once i submit the job i got this info, which i believe is good, probably a job number or run number

: hxn075000@g19 Macro; root -b -q 'test24_1.C("D","27")' >& test.log &
[2] 2761

But once i press Enter after submitting, it stopped,

: hxn075000@g19 Macro; 

[2]+  Stopped                 root -b -q 'test24_1.C("D","27")' >&test.l

And there is nothing in the log file except root’s signature message

Well, I don’t know. For example, this works fine for me (in the $ROOTSYS/tutorials dierctory):

root -l -b -q benchmarks.C >& benchmarks.log &The log file contains the regular output of benchmarks.C.
So maybe it depends on what’s happening in your macro…

Cheers, Bertrand.

May be…i have couple of ‘cout’ statements…will that affect? (I hope it should not…)

No, it should not, as the output is redirected…


Which version of root are you using? You can try explicitly detaching the process from the input terminal:root -b -q 'test24_1.C("D","27")' >& test.log </dev/null &



I use 5.26.

Thanks Philippe, your suggesion worked.


Note that this was fixed in more recent version of ROOT.


oh! Well, ya yesterday when i tried to install latest root relase 5.32 it gave me this

Configuring for linuxx8664gcc
Checking for GNU Make version >= 3.79.1 ... ok
Checking for C compiler ... gcc
Checking for C++ compiler ... g++
Checking for linker (LD) ... g++
Checking for F77 compiler ... no F77 compiler gfortran found
Checking for libX11 ... no
configure: libX11 (package libX11-devel) MUST be installed

Then i explored through root forums for help and also soft linked ‘libX11-6.so’ from /usr/lib to /usr/lib-32(or the other way round!!!) , but that didnt help either…can you please suggest how can go about it?

See root.cern.ch/drupal/content/inst … oot-source
and in particular root.cern.ch/drupal/content/build-prerequisites
in particular you need the 64 bits version of libX11-devel.