dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit ccf001851fc7f6d1ff31d9c8d70615b5280eaa3f
parent 4eb7fe041e23d1a1189a0fcf11d03668ee16a665
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Tue, 30 Jan 2018 19:04:59 -0500

vdirsyncer.sh: Use xsession.pid to check for running X server

Diffstat:
M.config/cron/vdirsyncer.sh | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/.config/cron/vdirsyncer.sh b/.config/cron/vdirsyncer.sh @@ -1,6 +1,14 @@ #!/bin/sh echo "Beginning sync on `date`" -export DISPLAY=`cat $HOME/.xdisplay` -vdirsyncer sync -unset DISPLAY +xsession_pid=`cat $HOME/.xsession.pid` + +if ps -U $LOGNAME -o pid= | grep $xsession_pid > /dev/null 2>&1 && type vdirsyncer > /dev/null 2>&1 +then + export DISPLAY=`cat $HOME/.xdisplay` + vdirsyncer sync + unset DISPLAY +else + echo "No X session running. Aborting" +fi + echo "Completed sync on `date`"