LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-15-2008, 01:05 PM   #1
bkone
Member
 
Registered: Jun 2006
Distribution: SUSE, Red Hat, Oracle Linux, CentOS
Posts: 108

Rep: Reputation: 15
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.
 
Old 02-15-2008, 03:31 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
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
 
Old 02-19-2008, 12:24 PM   #3
bkone
Member
 
Registered: Jun 2006
Distribution: SUSE, Red Hat, Oracle Linux, CentOS
Posts: 108

Original Poster
Rep: Reputation: 15
All the PCs are running Gnome for the GUI.
 
Old 02-19-2008, 04:02 PM   #4
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
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
 
Old 02-20-2008, 05:43 AM   #5
bkone
Member
 
Registered: Jun 2006
Distribution: SUSE, Red Hat, Oracle Linux, CentOS
Posts: 108

Original Poster
Rep: Reputation: 15
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?
 
Old 02-22-2008, 06:20 PM   #6
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

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

Brian
 
Old 02-23-2008, 02:36 AM   #7
kummiliim
Member
 
Registered: Mar 2007
Location: Tallinn, Estonia
Distribution: Slackware 12.0
Posts: 276

Rep: Reputation: 30
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.

Last edited by kummiliim; 02-23-2008 at 02:37 AM.
 
Old 02-25-2008, 03:47 PM   #8
bkone
Member
 
Registered: Jun 2006
Distribution: SUSE, Red Hat, Oracle Linux, CentOS
Posts: 108

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by kummiliim View Post
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?
 
Old 02-26-2008, 02:47 PM   #9
kummiliim
Member
 
Registered: Mar 2007
Location: Tallinn, Estonia
Distribution: Slackware 12.0
Posts: 276

Rep: Reputation: 30
Quote:
Originally Posted by bkone View Post
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."
 
Old 03-03-2008, 10:15 AM   #10
bkone
Member
 
Registered: Jun 2006
Distribution: SUSE, Red Hat, Oracle Linux, CentOS
Posts: 108

Original Poster
Rep: Reputation: 15
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.
 
Old 03-03-2008, 01:54 PM   #11
kummiliim
Member
 
Registered: Mar 2007
Location: Tallinn, Estonia
Distribution: Slackware 12.0
Posts: 276

Rep: Reputation: 30
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
Remote login with SSH, but display on remote computer. brodin Linux - Software 3 09-09-2007 03:01 AM
tightvnc - disabling 'remote administration' message mazinoz Linux - Security 6 03-17-2006 05:11 PM
send message to remote machine AcerKev Linux - Networking 6 02-13-2004 11:11 AM
remote shell error message slice4e Linux - General 1 05-12-2003 08:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration