#!/bin/bash ./Test.py & while true; do echo "Sleeping for five minutes" sleep 5m echo "Checking if ./Test.py is still running" if kill -0 %1; then echo "It is still running. Stopping it for 90 seconds." kill -STOP %1 sleep 90 echo "90 seconds up, backgrounding ./Test.py again." bg %1 else echo "It is no longer running. Finished." break fi LAYOUT="Top" WINFO=`xwininfo -root -tree -name "$LAYOUT Panel"| grep "pidgin" | cut -d ')' -f 2-` WIW=`echo $WINFO | cut -d 'x' -f 1` WIH=`echo $WINFO | cut -d 'x' -f 2 | cut -d '+' -f 1` WIX=`echo $WINFO | cut -d '+' -f 4` WIY=`echo $WINFO | cut -d '+' -f 5` let WAX=WIX+WIW/2 let WAY=WIY+WIH/2 dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/water/allscreens/point org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print $4 }'` string:'amplitude' double:1 string:'x' int32:$WAX string:'y' int32:$WAY sleep 4 done