b3rs3rk / gpustat-unraid

An UnRAID plugin for displaying GPU status
https://forums.unraid.net/topic/89453-plugin-gpu-statistics/?tab=comments#comment-830112
MIT License
50 stars 12 forks source link

#40 Update field captured in getParentCommand #47

Closed shadow7412 closed 1 year ago

shadow7412 commented 1 year ago

image

b3rs3rk commented 1 year ago

@shadow7412 Thanks for the contribution. I did a quick test and see that you're getting around the issue by selecting the second field. Can we modify it a little bit though? I don't like accounting for the whitespace by grabbing field 2 and would rather change the awk output to trim the leading whitespace:

ps j 42983 | awk '{$1=$1};NR>1' | cut -d ' ' -f 1

In the future if that command for any reason stops padding the front of the output with whitespace it shouldn't matter. Field one should always be the PPID, space or no.

shadow7412 commented 1 year ago

Yep, that makes sense. I confirmed the fix by running the command locally, and have updated the PR.