[gentoo-user] Re: How to tell Cron X is running or not
Neil Bothwick <[EMAIL PROTECTED]> writes: > pidof X Vey nice ... Neil are those green bananas on your head or leaves? -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] Re: How to tell Cron X is running or not
On Sun, 25 Nov 2007 20:40:08 -0600, [EMAIL PROTECTED] wrote: > Yup, both of those should work from cron or anywhere. In my case and > probably many other as well, I could shorten the ps approach to: > ps aux|grep '[X] :0' Or use "pidof X". -- Neil Bothwick Top Oxymorons Number 46: Found missing signature.asc Description: PGP signature
Re: [gentoo-user] Re: How to tell Cron X is running or not
On Sun, Nov 25, 2007 at 08:40:08PM -0600, [EMAIL PROTECTED] wrote: > Yup, both of those should work from cron or anywhere. In my case and > probably many other as well, I could shorten the ps approach to: > ps aux|grep '[X] :0' > > But looking for /tmp/.X0-lock is probably the most reliable. Thanks Try xdpyinfo. If $DISPLAY is not set, try xdpyinfo -display :0.0 for the usual main display. ssh -X -Y makes up its own names, but you haev to figure out whether cron programs should even know about the display in general, or the ssh ones in particular. At any rate, try this: if xdpyinfo >/dev/null; then echo "X running"; else echo "No X"; fi -- ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._. Felix Finch: scarecrow repairman & rocket surgeon / [EMAIL PROTECTED] GPG = E987 4493 C860 246C 3B1E 6477 7838 76E9 182E 8151 ITAR license #4933 I've found a solution to Fermat's Last Theorem but I see I've run out of room o -- [EMAIL PROTECTED] mailing list
[gentoo-user] Re: How to tell Cron X is running or not
"Andrey Falko" <[EMAIL PROTECTED]> writes: > How about something like this: retval=`ps aux | grep tty | grep X | awk > '{print $2}'` > > Or retval=`cat /tmp/.X0-lock` > > Or even better: > > if [[ -e "/tmp/.X0-lock" ]];then Yup, both of those should work from cron or anywhere. In my case and probably many other as well, I could shorten the ps approach to: ps aux|grep '[X] :0' But looking for /tmp/.X0-lock is probably the most reliable. Thanks -- [EMAIL PROTECTED] mailing list