On Thu, Mar 13, 2003 at 12:10:56PM -0000, Keith Watson wrote:
Any ideas on this one?
My system is based on Debian Woody, I'm using Gnome 1.4 with Enlightenment 0.16.5 with Nautilus as my desktop manager (so I can drop icons on the desktop - works a treat! :o) ).
I'm using 'chbg' to randomly change my desktop background and that works fine too
Problem is I've set chbg as an application to startup with Gnome when I log in, trouble with that is that each time I log out and then back in another copy of chbg starts up.
How do I prevent multiple copies of chbg starting up?
you could run a wrapper script around it which writes its pid value to /var/run/chbg.pid then when the wrapper script starts it can use pgrep to looks for itself on the process table compare the value in the chbg.pid file to what is running at that pid too and either start if there is none already running, or bail out if its confused and the pid doesn't match the program running etc. etc.
Of course this method is not bullet proof and does not cover every eventuality, but then its quick, dirty and will work. Also as it doesn't sound like a production system type scenario then it will be ok. (note not perfect though!)
Adam