I am programming a python program for the raspberry pi. Is there a way for me so that when the raspberry pi outputs text, it will show up on all terminals that are currently remotely logged in via SSH?
You can try to use the
wall program, but the logged in users may be able to override that and avoid seeing any
wall messages. Alternately, you can attempt configure and use syslog to send a message from a given facility to the
* location, which (in my experience) will show up on all logged in shells.
In a very simplistic way: you can look at all the pseudo-ttys in use
and write to all of them. Use
who to list all the current logins and
their tty, eg:
$ who me tty1 Jun 1 07:09 brian pts/0 Jun 1 07:15 (:pc1) john pts/1 Jun 1 07:15 (:pc88) sue pts/2 Jun 1 07:15 (:pc7)
The 2nd column shows e.g.
/dev/pts/0 is being used by login
brian. You can simply write to it, if you have sufficient permission, eg:
echo 'Msg from me: hello!' >/dev/pts/0
On my system (not a pi, sorry), you need to be in group tty, or be root:
$ ls -l /dev/pts/0 crw--w---- 1 brian tty 136, 4 Jun 28 20:55 /dev/pts/0