Skip to content
Snippets Groups Projects
Commit 37956581 authored by Jafar Lie's avatar Jafar Lie
Browse files

commit

Former-commit-id: 7a126398
parent b2dbbd6a
No related branches found
No related tags found
No related merge requests found
......@@ -3,18 +3,28 @@
# Grep to find out whether there's X process running and user logged in
# Is Desktop running on this machine? Anything greater than 0 means yes
DESKTOPRUNNING=`/opt/slurm-16.05.4/bin/squeue | grep desktop | grep -c $HOSTNAME`
SLURMCMD=`which sacct`
if [ -n "$SLURMCMD" ]
then
SLURMCMD="$SLURMCMD -a --name=desktop --state=running --nodelist=$HOSTNAME --parsable --noheader | grep -c RUNNING"
else
exit 1
fi
DESKTOPRUNNING=`eval "$SLURMCMD"`
# Is X running? Anything greater than 0 means yes
XRUNNING=`ps aux | grep "/usr/bin/X" | grep -c root`
XRUNNING=`ps aux | grep "X :" | grep -c root`
# This checks if no desktop is running but X is still there
if [ "$DESKTOPRUNNING" == 0 ] && [ "XRUNNING" > 0 ]
if [ "$DESKTOPRUNNING" == 0 ] && [ "$XRUNNING" > 0 ]
then
# Trying to get XPID
if [ -z "$XPID" ]
XPID=`ps -ef | grep "X :" | grep root | awk '{print $2}'`
if [ -n "$XPID" ]
then
XPID=`ps -ef | grep "/usr/bin/X" | grep root | awk '{print $2}'`
kill $XPID > /dev/null 2>&1
fi
fi
---
- name: Copy cleanup-x.sh to the server
copy:
src: cleanup-x.sh
template:
src: cleanup-x.sh.j2
dest: /usr/local/bin/cleanup-x.sh
mode: 0755
owner: root
......
......@@ -151,6 +151,7 @@
- name: run nvidia-xconf-gen
script: scripts/nvidia-xconf-gen.py
register: nvidiacards
check_mode: no
- name: set env for nvidia_card_lists
set_fact:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment