You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
920 B
31 lines
920 B
#!/bin/bash
|
|
|
|
mkdir -p /tmp/smartauthmon/
|
|
ls /var/run/xdmctl > /tmp/smartauthmon/originalxdm
|
|
|
|
# Set loop separator to end of line
|
|
BAKIFS=$IFS
|
|
IFS=$(echo -en "\n\b")
|
|
exec 3<&0
|
|
exec 0</tmp/smartauthmon/originalxdm
|
|
newdisplayfound=0
|
|
newdisplay=-1
|
|
while read -r line
|
|
do
|
|
# use $line variable to process lines
|
|
line=$(echo $line | grep 'xdmctl-:' | sed -e 's/xdmctl-://')
|
|
if [ "`expr $line - $line 2>/dev/null`" == "0" ]; then
|
|
echo "Found active display on $line"
|
|
if [[ $newdisplayfound -eq 0 ]]; then
|
|
tempnewdisplay=$((newdisplay + 1))
|
|
if [[ $line -eq $tempnewdisplay ]]; then
|
|
echo "Sequential display $line found after display $newdisplay..."
|
|
newdisplay=$line
|
|
fi
|
|
fi
|
|
fi
|
|
done
|
|
exec 0<&3
|
|
newdisplay=$(($newdisplay + 1))
|
|
rm -rf /tmp/smartauthmon/
|