I was running a big overnight batch program last night written in Java on a Linux based server. I can’t seem to find anything in my error logs that suggests an error was encountered in my Java application.
Is there a way in Linux to see if a program exited unexpectedly?
The program is one of many programs that get run overnight off a chronjob/tab and runs off its own main method. It catches a series of exceptions which prints messages to System.err.println and exits with status one if these are hit.
NB: I always use a Logger in my code unfortunately I’m dealing with legacy code written by someone else.
Because you’ve run your programs out of
cron(8), there’s a good chance that the standard error of the program has in fact been captured and mailed somewhere.Check the
crontab(5)for the user account that runs the program. (If it is run out of/etc/crontabor/etc/cron.d/, then in those files.) Look for theMAILTOvariable. If it doesn’t exist, thencron(8)tried to deliver mail to thecrontab(5)owner. If it does exist, thencron(8)tried to deliver mail to whoever is specified with the variable.Look in
/var/spool/mail/for the user’s mailbox, if the server doesn’t seem like it’s got an email setup in place — there might be enough for local delivery.