What I meant is that after you have executed the command "/usr/bin/java...." and it finishes, you then execute "echo $?" (do not execute any additional commands in-between).
Code: Select all
Error setting up log file null: File already exists and cant delete it (is it in use?)
Exception saving output file [cu_output.xml]: java.io.FileNotFoundException: cu_output.xml (Permission denied)
There you go...
The command tries to delete/create the file "cu_output.xml". Where a can not tell, but probably someplace where root is allowed to write but the nagios user is not, OR, root has created the file (from your command that was run as root) and the nagios user is not allowed to delete/recreate the file.
Do a search to find the "cu_output.xml" file (find / -name cu_output.xml) and check the creation time - if it matches with when you run your command as root, then delete the file and try rerunning the command as nagios (WITHOUT trying to run it as root in between)..
You could maybe also try to add "-xmloutputfile ’/tmp/cu_output.xml’" to the command line (I do not know the CompCU.jar application so I am not sure if this works, but I saw this option in the manual).