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

clean up X script and cron install

parent eab73154
No related branches found
No related tags found
2 merge requests!161Slurm epilog,!151clean up X script and cron install
#!/bin/bash
# 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`
# Is X running? Anything greater than 0 means yes
XRUNNING=`ps aux | grep "/usr/bin/X" | grep -c root`
# This checks if no desktop is running but X is still there
if [ "$DESKTOPRUNNING" == 0 ] && [ "XRUNNING" > 0 ]
then
# Trying to get XPID
if [ -z "$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
dest: /usr/local/bin/cleanup-x.sh
mode: 0755
owner: root
sudo: true
- name: Install cron job on VisNodes
sudo: true
cron:
name: Clean up X Check
special_time: hourly
job: /usr/local/bin/cleanup-x.sh
user: root
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