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?
Keith ____________
Courage does not always roar, sometimes, it is the quiet voice at the end of the day saying; 'Sod it! Let's go down the pub!!'
On Thursday 13 March 2003 12:10, Keith Watson wrote:
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?
How about writing a script that takes the output of ps, seaches for an existing chbg and only runs it if there isn't one already running? Using GAWK perhaps?
My gawk is a bit rusty so I can't provide an example :-) Just think of me as the ideas man...
BenE
On Thu, 13 Mar 2003 22:01:22 +0000 BenEBoy mail@psychoferret.freeserve.co.uk wrote:
On Thursday 13 March 2003 12:10, Keith Watson wrote:
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?
How about writing a script that takes the output of ps, seaches for an existing chbg and only runs it if there isn't one already running? Using GAWK perhaps?
My gawk is a bit rusty so I can't provide an example :-) Just think of me as the ideas man...
That was my initial train if thought also, and fortunately good ol' Aeleen Frisch even gives a pretty close example in Essential Sys. Admin.
It seems a bit unsubtle/inelegant/whatever. Heigh Ho! (now where did I leave that 5kg club hammer?) :o)
Keith
On Thu, Mar 13, 2003 at 10:01:22PM +0000, BenEBoy wrote:
How about writing a script that takes the output of ps, seaches for an existing chbg and only runs it if there isn't one already running? Using GAWK perhaps?
Something like:
`ps ax | grep chbg && chbg <args>`
? That's rather unlikely to be perfect, but a good start anyway. Might need some brackets, check your shell dox. An obvious refinement is to be a little more selective with grep.
Alexis
Alexis Lee lxs@sys.uea.ac.uk wrote:
`ps ax | grep chbg && chbg <args>`
Sadly, that will pick up the grep chbg process if your system is anything less than ideal. Better to use pgrep or pidof instead.
MJR
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