[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Logout, shut down autostarted app in openbox?



Hi,

I have a nicely working script for rotating backgrounds in openbox. It
is initiated in autostart.sh.  My trouble involves having this shut
down if I log out, then back in at a later time.  The first instance
does not get terminated, so my backgrounds begin to change at really
interesting rates...

Is there a check of some sort I can put into the script in the
beginning that will either exit if another instance is running, or shut
that earlier one down and continue on?  

The script is off some online forum, called by:

./.config/openbox/wallpaperRandomSwitch.sh 

in autostart.sh.  The script itself:

#!/bin/bash
shopt -s nullglob
cd ~/Pictures

while true; do
	files=()
	for i in *.[Jj][Pp][Gg] *.png; do
		[[ -f $i ]] && files+=("$i")
	done
	range=${#files[@]}
	((range)) && feh --bg-max "${files[RANDOM % range]}"
	sleep 15m
done

Many thanks for suggestions!


Kenward
-- 
In a completely rational society, the best of us would aspire to be 
_teachers_ and the rest of us would have to settle for something less, 
because passing civilization along from one generation to the next 
ought to be the highest honor and the highest responsibility anyone 
could have.     - Lee Iacocca


Reply to: