kdewall, simple workaround missing /utmp entry
Some may know konsole adds no /utmp entry (good) but also
currently kwrited only wastes memory (bad). I've had to
write a little script to make use kwrited. (If I shutdown
our server a second time without some users getting an info msg
.... oh oh).
I'm open for suggestions and better solutions ;)
Share and enjoy,
## kdewall: simple wall for Debian/KDE
## KDE KDE users which use only konsole never see
## wall messages (no utmp entry 'cause Debian
## does not like libtempter and it has not HAVE_LIBUTIL)
## (at least now kwrited does not only waste memory :)
if [ $# -ne 1 ]; then
echo "Usage: $prg msgfile" >&2
if [ -f "$1" -a -r "$1" ]; then
echo "File not found or not readable: '$1'" >&2
msgheader="Message from '$USER@$HOSTNAME' (`date`):"
# selection of kwrited processes:
# o find all /bin/cat processes
# o check if parent is kwrited
# o write to all ptys of bin
echo "informing kwriteds ..."
ps ax -o pid,ppid,cmd | grep /bin/cat | grep -v grep |
while read pid ppid foo; do
#ps -o pid,ppid,cmd -p $ppid;
#ps -o ppid,pid,tty,cmd -p $pid --no-header
pty=/dev/"`ps -o tty -p $pid --no-header`"
if [ -w "$pty" ]; then
case "$pty" in
printf "\n$msgheader\n" > "$pty"
cat "$msgfile" > "$pty"
printf "\n--\n" > "$pty"
echo "$prg: msg send to '$pty'"
echo "$prg: Invalid pty name: '$pty'" >&2
echo "$prg: '$pty' not writeable" >&2
echo "using wall ..."
To me vi is Zen. To use vi is to practice zen. Every command is
a koan. Profound to the user, unintelligible to the uninitiated.
You discover truth everytime you use it.