1

I would like to display a whiptail message on the login screen that is triggered by monit, but I am without luck.

I understand it might be something to do with interactive/non-interactive shell. Here is the script that gets triggered by monit.

#!/bin/bash
/usr/bin/whiptail --infobox 'Hello World.' 7 25 >/dev/tty1

Is there a trick, or should I avoid using whiptail?

  • Does the --infobox option work for you from just a regular shell? I just tried it and it doesn't do anything, --msgbox works though. – slm Jul 25 '13 at 1:03
0

I just tried the following and was able to send output from my desktop to /dev/tty2 using whiptail so I think what you're doing would seem feasible. Couple of things that I noticed.

1. permissions

I needed to be root in order to send anything to /dev/tty2. I'm assuming you're running this as a monit user who would most likely not have permissions to send data to and tty device.

2. --infobox

The --infobox switch didn't appear to work in my current shell but I was able to send an --infobox to /dev/tty2. YMMV. --msgbox worked in both cases.

  • I can send echo 'Hello World.' >/dev/tty1 using monit, so it is not permissions. Also, --infobox will dismiss itself without waiting for user input, but the display will remain if you send it from another console. – Yuri Jul 25 '13 at 12:22
0

The "trick" is that whiptail (like dialog) writes its messages by default to the standard error, because conventional program use the standard output for screen updates.

You can redirect the standard error by putting a 2 next to the > mark:

#!/bin/bash
/usr/bin/whiptail --infobox 'Hello World.' 7 25 2>/dev/tty1

Further reading:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.