LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Remote message SSH (https://www.linuxquestions.org/questions/linux-networking-3/remote-message-ssh-621420/)

bkone 02-15-2008 01:05 PM

Remote message SSH
 
I have 8 Kiosk PCs that I manually patch via SSH. Is there a way after I apply the patches to send a message to the remote PC notifying any users that the system is going to reboot in x minutes? I am running Suse and tried the shutdown -r +1 System is going to reboot in 1 minute but the message doesn't broadcast to the remote PC. I basically want to notify any user that may be logged in to wrap up before the PC reboots.

Brian1 02-15-2008 03:31 PM

Are they using a gui interface?
Are there mulitple gui interfaces up or just a single one with a single user.
If gui post which one.

Brian

bkone 02-19-2008 12:24 PM

All the PCs are running Gnome for the GUI.

Brian1 02-19-2008 04:02 PM

You can use the xmessage to display a message on an X screen. This may work if using a script to do the reboot.

#!/bin/bash
/usr/bin/xmessage -center -file /etc/systemdown.txt &
/bin/sleep 1m
/sbin/shutdown -r now

In your /etc/systemdown.txt text file place something like this.
System is going down in one minute.
Please save and exit.

The use of & on the xmessage line drops the screen display to the background so the script contiues on. If not then the user can hold the script to the user clicks OK.

Brian

bkone 02-20-2008 05:43 AM

Thanks Brian. So I need to place the shutdown.txt file on all these PCs in the /etc directory correct? I can then execute the script remotely?

Brian1 02-22-2008 06:20 PM

That is what i would do. Just have an example like I did and then you can ssh in and run the script.

Brian

kummiliim 02-23-2008 02:36 AM

Also Gnome uses notification daemon so it might be prettier if you do something like
Code:

notify-send "Reboot" "System is going down for a reboot in 1 minute for upgrades. Please save all your work.
instead of xmessage. See if it works : ). You can also use notify-send --help to see the other options. Emergency could be turned high and a nice picture added. I'm also pretty sure your script will have to find out which X display is being used and use that for transfering the message.

bkone 02-25-2008 03:47 PM

Quote:

Originally Posted by kummiliim (Post 3066992)
Also Gnome uses notification daemon so it might be prettier if you do something like
Code:

notify-send "Reboot" "System is going down for a reboot in 1 minute for upgrades. Please save all your work.
instead of xmessage. See if it works : ). You can also use notify-send --help to see the other options. Emergency could be turned high and a nice picture added. I'm also pretty sure your script will have to find out which X display is being used and use that for transfering the message.

Is there something else that needs to be done for the notify-send to work. I looked and the notification daemon is running but I fire that command off in a terminal window and it just gives me the > and just sites there. What am I doing wrong?

kummiliim 02-26-2008 02:47 PM

Quote:

Originally Posted by bkone (Post 3069517)
Is there something else that needs to be done for the notify-send to work. I looked and the notification daemon is running but I fire that command off in a terminal window and it just gives me the > and just sites there. What am I doing wrong?

Hehe, I missed a quote. Here:
Code:

notify-send "Reboot" "System is going down for a reboot in 1 minute for upgrades. Please save all your work."

bkone 03-03-2008 10:15 AM

I tried it out again but it only pops up on the PC I am working on. Does this not work if using SSH? Here is what I am doing.

I connect to the remote PC via SSH. I keyed in the net-send command "Rebooting" "System is going to reboot in 15 minutes to apply updates." I receive the message on the host PC and don't see anything happening on the remote PC I am ssh'ing into.

kummiliim 03-03-2008 01:54 PM

Afaik, the $DISPLAY variable has to be set to the display that is currently used on the remote computer. I have never successfully tried that so I think someone else can help you better with this.


All times are GMT -5. The time now is 12:10 AM.