Main Page | Report this Page
Linux Forum Index  »  Linux X  »  Where the output is going?...
Page 1 of 1    

Where the output is going?...

Author Message
HamRadio...
Posted: Sun Mar 29, 2009 5:05 am
Guest
Hi,

I have a script, launched during boot, which occasionally has to give
some information to the user, no matter if the user is in console or in
an X session, something like:

/usr/bin/notify-send -- "information" "hallo how r u?"

or

/usr/bin/zenity --info --title="information" --text "hallo how r u?"

but during an X session no output can be seen.

Of course the commands above work fine if I launch them in an Xterm, so I
guess the problem is that the script has been launched before X was
started, so who knows where that output goes?

I've tried including

DISPLAY=:0

or

DISPLAY=127.0.0.1:0

at the beginning of the script, but it still doesn't work.

I'd like not to launch this script *after* X, because it has to work also
if nobody starts an X session.

Thank you in advance for your help.



--
toglimi.hamradio at (no spam) toglimi.quipo.it
ANTI-SPAM: please cut "toglimi." for my real e-mail address.
Intel Core2 Duo P8400, Linux 2.6.28.8 on Debian GNU/Linux 5.0
Registered Linux user #291116 http://counter.li.org
 
jr4412...
Posted: Sun Mar 29, 2009 7:34 am
Guest
hi,

Quote:
I have a script, launched during boot, which occasionally has to give
...
Of course the commands above work fine if I launch them in an Xterm, so I
guess the problem is that the script has been launched before X was
started, so who knows where that output goes?
...
I'd like not to launch this script *after* X, because it has to work also
if nobody starts an X session.

off the top of my head, write a small "wrapper" script; first launch
yr script, redirecting stdout to file, then launch X conditional on
DISPLAY var existing. you can now retrieve the file to get the
"information".
 
Moe Trin...
Posted: Sun Mar 29, 2009 1:37 pm
Guest
On Sun, 29 Mar 2009, in the Usenet newsgroup comp.os.linux.x, in article
<gqo2o2$k88$1 at (no spam) tdi.cu.mi.it>, HamRadio wrote:

Quote:
I have a script, launched during boot, which occasionally has to give
some information to the user, no matter if the user is in console or
in an X session,

Problem: xterms and virtual terminals are not the same devices.

Quote:
Of course the commands above work fine if I launch them in an Xterm,
so I guess the problem is that the script has been launched before X
was started, so who knows where that output goes?

It's probably going to stdout for where-ever it was launched. But
where is that?

Quote:
I'd like not to launch this script *after* X, because it has to work
also if nobody starts an X session.

[compton ~]$ whatis mesg wall
mesg (1) - control write access to your terminal
wall (1) - send a message to everybody's terminal.
[compton ~]$

'wall' used to be used to send messages to everyone logged in -
such as the fact that the system was going to be shut down, or that
free food was available at some location. The problem is that people
got tired of having their display showing messages they were not
interested in, and learned to use the 'mesg n' command in a shell
startup script (for bash, ~/.bashrc) to disable such messages.

Old guy
 
Tim Roberts...
Posted: Sun Mar 29, 2009 4:16 pm
Guest
HamRadio <toglimi.hamradio at (no spam) toglimi.quipo.it> wrote:
Quote:

I have a script, launched during boot, which occasionally has to give
some information to the user, no matter if the user is in console or in
an X session, something like:

/usr/bin/notify-send -- "information" "hallo how r u?"

or

/usr/bin/zenity --info --title="information" --text "hallo how r u?"

but during an X session no output can be seen.

Of course the commands above work fine if I launch them in an Xterm, so I
guess the problem is that the script has been launched before X was
started, so who knows where that output goes?

It goes to the console session. If you switch VTs back to VT 1, you'll
probably see it there.

If there *IS* an X session, where do you want the output to go? How do you
want it to be seen? An X session doesn't necessarily imply there are any
windows present. What if there are 5 X sessions? And a couple of ssh
sessions as well?

You can certainly modify the X startup script so that it launches a
background X application of your own design that listens for these
broadcasts and pops up a message box.
--
Tim Roberts, timr at (no spam) probo.com
Providenza & Boekelheide, Inc.
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Fri Dec 11, 2009 6:54 pm