LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Announcing a restart to the Network (https://www.linuxquestions.org/questions/linux-general-1/announcing-a-restart-to-the-network-125308/)

scottpioso 12-12-2003 03:47 PM

Announcing a restart to the Network
 
I'm running Linux as a server and I wish to announce when the system will be rebooting to the network. I have Windows users connecting via SMB and I wish to broadcast a message stating that the server will be rebooting in two minutes, please save all of your work now!

How could I do this? thank you.

darthtux 12-12-2003 10:51 PM

http://www.oreillynet.com/linux/cmd/...ath=s/shutdown

scottpioso 12-13-2003 08:57 AM

Hi Darth,

Thank you. However, is that for a broadcast over a network?? I don't have the time right now to look at in close detail, but from the little I saw, it would appear that is for a user sitting at the Linux box. The message needs to be broadcast accross the network to my Windows clients. I'll take a closer look at it later, but are you sure that's what this is for?

llamakc 12-13-2003 01:57 PM

You can send popups with smbclient. I don't know the syntax but I worked in an environment where that was done. I think it was:

smbclient -M or something like that.

downinthemine 12-13-2003 02:44 PM

The command is:

smbclient -M <name of computer you want to message>

You then get a prompt where you can enter your message

I only have one other computer on my network, so I am not sure whether you can enter multiple names at the command line or not.

scottpioso 12-13-2003 03:36 PM

Very good. That worked. However, to run an automated message at a particular time??? Say, for example, the server will be rebooting in 5 minutes, save your work now!!

I want to shove that into cron 5 minutes before the server will restart. I started a script to do it. It's not working though. How would I automate this?? What has happened when I ran it is it runs the smbclient -M but does not send the message in the script. Perhaps I'll ask a friend of mine.

This is what I have so far. . . To force the system to do ctrl-d and send that message I'm not sure about. Any ideas?

-------------------------------------------------------------------------------------------------

# This script will send a winpopup message to the smbclients in your workgroup

smbclient -M hp-pavilion-pi

The Linux Server will be rebooting in 5 minutes. . . Please save all of your work now!!

scottpioso 12-14-2003 02:52 PM

Hi Everyone,

Well, I thought I would share with you my solution. If anyone has any better ideas, I'm all ears. This is what I did:

I made three separate text files (for 5 min, 3 min, and 1 min) for the different warnings. They are named:

restart5.txt
restart3.txt
restart1.txt

Then, I made 3 short shell scripts to execute them:

restart5.sh

# This script will send a WinPop message to the Windows Clients 5 minutes
# prior to restart.

cat restart5.txt | smbclient -M hp-pavilion-pi

restart3.sh

# This script will send a winpop to the Windows machines 3 min before restart

cat restart3.txt | smbclient -M hp-pavilion-pi

And so on. . .

Next I plugged the scripts into CRON to run at the appropriate times. Maybe that's a backwards way of doing it, but again, if someone else has any better ideas, I'm totally all ears!!

llamakc 12-14-2003 03:02 PM

You could wrap it into one script and use the at command and take it out of CRON.

scottpioso 12-14-2003 03:39 PM

Umm, how would I do that???


All times are GMT -5. The time now is 09:14 PM.