egpu-tk/cmd/get_egpu_process

28 lines
496 B
Bash

#!/usr/bin/env bash
for proc in "/proc"/*; do
first_arg=1
xfconf=0
while IFS= read -r -d '' proc_arg; do
if [ "$first_arg" = "1" ]; then
if ! [[ "$proc_arg" == *"Xorg" ]]; then
break
fi
first_arg=0
continue
fi
if [ "$xfconf" = "1" ]; then
if ! [ "$proc_arg" == "$IGPU_XORG_CONFIG" ]; then
echo "$(basename "$proc")"
exit 0
fi
break
fi
if [ "$proc_arg" = "-config" ]; then
xfconf=1
fi
done < <(cat "$proc/cmdline" 2>/dev/null)
done
exit 0