diff options
Diffstat (limited to 'sysutils/consolekit/files/ck-get-x11-server-pid')
-rw-r--r-- | sysutils/consolekit/files/ck-get-x11-server-pid | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sysutils/consolekit/files/ck-get-x11-server-pid b/sysutils/consolekit/files/ck-get-x11-server-pid new file mode 100644 index 000000000000..05c433e0175e --- /dev/null +++ b/sysutils/consolekit/files/ck-get-x11-server-pid @@ -0,0 +1,17 @@ +#!/bin/sh + +SED="/usr/bin/sed" +CAT="/bin/cat" + +dispnum=0 +if [ ! -z "${DISPLAY}" ]; then + dispnum=$(echo ${DISPLAY} | ${SED} -E -e 's|:([0-9]+).*|\1|') +fi + +if [ ! -f "/tmp/.X${dispnum}-lock" ]; then + echo "ERROR: Failed to find X lock file for display ${dispnum}" + exit 1 +fi +pid=$(${CAT} "/tmp/.X${dispnum}-lock") + +echo ${pid} |