I am looking for a reliable way to get the full command line args passed to a process even when these are very long.
I do know about
ps -f -p <pid> and
/proc/<pid>/cmdline, both of which are usually up to the job. The problem is that both of these seem to truncate the command line args at 4096 chars, and I know for a fact that this one is longer ( It's a java application and the output truncates in the middle of the classpath string), and
xargs --show-limits tells me that my system allows up to 2094184 argument length.
Is there a way to do this?
UPDATE: I was able to get the full command line args string by making a wrapper that I placed earlier in the PATH and logged the args to a file before calling the right binary with the same args.
#!/bin/bash file=/tmp/commandtrap-$$.log /usr/bin/echo "$@" >$file /usr/lib/jvm/java-7-openjdk/jre/bin/java "$@"
This is, however, an ugly workaround that only works because I could stop and run the process.
Ideally, there should be a way to obtain the full command without the need to close the running process (or disturbing it in any way)