Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473
Rep:
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!
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473
Original Poster
Rep:
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?
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473
Original Poster
Rep:
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?
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473
Original Poster
Rep:
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!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.