Notifying via Terminal in Linux

  • Thread starter Kurtis Rainbolt-greene
  • Start date
K

Kurtis Rainbolt-greene

So I've got this idea for a linux CLI program, and one of the things I
want the program to do is notify Users of an event via the terminal.

Is there something out there I can use to do this? I was thinking of
using the WALL command, but that seems sloppy and requires reading from
a file (for ubuntu).
 
I

Iñaki Baz Castillo

El Viernes, 15 de Enero de 2010, Kurtis Rainbolt-greene escribi=C3=B3:
So I've got this idea for a linux CLI program, and one of the things I
want the program to do is notify Users of an event via the terminal.
=20
Is there something out there I can use to do this? I was thinking of
using the WALL command, but that seems sloppy and requires reading from
a file (for ubuntu).

WALL command doesn't require reading from a file, it reads the STDIN.

When you do "wall < FILE" you are redirecting the STDIN to the file, so the=
=20
content of the file is passed to wall via STDIN.

When you run "wall" (just "wall") you must insert text with the keyboard an=
d=20
press Ctrl+D to exist and deliver the message.

So in Ruby you could redirect the STDIN (better $stdin) to invoke the syste=
m=20
command (not sure now how to achieve it but sure it's possible).


=2D-=20
I=C3=B1aki Baz Castillo <[email protected]>
 
J

Jonathan Nielsen

Is there something out there I can use to do this? I was thinking of
WALL command doesn't require reading from a file, it reads the STDIN.

When you do "wall < FILE" you are redirecting the STDIN to the file, so the
content of the file is passed to wall via STDIN.

When you run "wall" (just "wall") you must insert text with the keyboard and
press Ctrl+D to exist and deliver the message.

So in Ruby you could redirect the STDIN (better $stdin) to invoke the system
command (not sure now how to achieve it but sure it's possible).

Yes, use popen3 to get a reference to stdin of the wall process and
write into the stdin. Should work anyway...

-Jonathan Nielsen
 
A

Albert Schlef

Kurtis said:
So I've got this idea for a linux CLI program, and one of the things I
want the program to do is notify Users of an event via the terminal.

I think this utility already exists: syslog. It can also output certain
messages to the terminal.
 
I

Iñaki Baz Castillo

El Viernes, 15 de Enero de 2010, Jonathan Nielsen escribi=F3:
=20
Yes, use popen3 to get a reference to stdin of the wall process and
write into the stdin. Should work anyway...

With popen4 you also get the correct exit status code of the command :)

=2D-=20
I=F1aki Baz Castillo <[email protected]>
 
J

Jean-Julien Fleck

Hello Kurtis,

2010/1/15 Kurtis Rainbolt-greene said:
So I've got this idea for a linux CLI program, and one of the things I
want the program to do is notify Users of an event via the terminal.

Is there something out there I can use to do this? I was thinking of
using the WALL command, but that seems sloppy and requires reading from
a file (for ubuntu).

If your program is intended to be run from the command-line, why a
simple "puts" would not be enough ? It will naturally write to STDOUT
which is the terminal that ran the command.

BTW, I don't think that users will be pleased if your program write on
*all* their open terminals using wall. I usually have 16 of them open,
each doing a different thing and a program that periodically write
things on all of them will quite rapidly upset me.

Cheers,

--=20
JJ Fleck
PCSI1 Lyc=E9e Kl=E9ber
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,219
Latest member
KristieKoh

Latest Threads

Top