I have an issue where running sudo iscsiadm -m discovery -t st -p IP -l logs to dmesg across all terminals on the server.
The command is run from a java application, using:
Runtime.getRuntime().exec("/bin/bash", "-c", "sudo iscsiadm -m discovery -t st -p *IP* -l");
I have tried the following:
- Apppending
> /dev/null 2>&1
to the end of theiscsiadm discovery...
command - Capturing input streams from the returned progress (
process.getInputStream()
andprocess.getErrorStream()
) - Appending
> /dev/null 2>&1
to the software launching the Jar.
None of the above attempts prevent logging across all virtual terminals. The log starts [some_num.some_dec] LOG_MESSAGE
which suggests it is outputting to dmesg
? If this is true how do I prevent this? Currently it makes the system impossible to debug because it's printing over the terminal prompt.
Thanks
Issue fixed.
It turns out it was not iscsiadm logging to dmesg, it was the mount command afterwards because the blockdev did not exist.
I have modified my java code to try
iscsiadm -m discovery...
then runiscsiadm -m session
to determine if the appropriate device has a connection or not prior to mounting.