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.
|
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 |
All the PCs are running Gnome for the GUI.
|
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 |
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?
|
That is what i would do. Just have an example like I did and then you can ssh in and run the script.
Brian |
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. |
Quote:
|
Quote:
Code:
notify-send "Reboot" "System is going down for a reboot in 1 minute for upgrades. Please save all your work." |
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. |
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. |