Run an NXT 2 program that will continue until no power is left in batteries
Use the Keep Alive Block in your program.




  This block will keep the NXT from entering sleep mode. Add this block
  if your program needs to wait for longer than the NXTs set "sleep
  time" (configured using the NXTs on-board menus).


The Time until sleep plug will take a value from 0 - 4294967296 (168) milliseconds .

4294967296 milliseconds is just over 49 days which is most likely a lot longer than the battery lifespan and much, much longer then you would/should normally be running it for.