Koozali.org: home of the SME Server
Obsolete Releases => SME Server 7.x => Topic started by: E-MaN_ on August 30, 2006, 11:16:21 AM
-
I'm looking for the correct place to be able to notify windows users that the server is going down or reboot.
In rc.local I've put a line: echo server is up! | smbclient -M winboxes
Now I would like to have somewhere:
echo server is going down/reboot in xx seconds, please logoff | smbclient -M winboxes
I couldn't find this anywhere in the forums.
-
Write your own script called say, down.sh, that controls this:
#!/bin/bash
SHUTDOWNDELAY=1
DELAY=$[$1-$SHUTDOWNDELAY]
echo Server is going down in $N minutes please save your work and log off! | smbclient -M winboxes
sleep "$DELAY"m
echo Warning: only 1 minute left before server reboots! | smbclient -M winboxes
shutdown -k +$SHUTDOWNDELAY
exit 0
Put this into a script in say /usr/local (which is on the path) and use this to manage the shutdown (don't forget to make it executable)
Call it with:
down.sh 5
-
Ok. Great!
And what if I would make that automatic?
Is there a place I could create/replace the template to reboot, so if I'm booting it from the server-panel it will run that part?
-
The 'action/event' that is attached to the panel button is not templated and would require hacking to acheive what you want, could be done but would not be recommended.
-
ok then. I can't just add een template to achieve what I want.
I'll stick with your solution then.
Thank you.
-
The 'action/event' that is attached to the panel button is not templated and would require hacking to acheive what you want...
That is incorrect.
OP should create a notification script. Add a symlink to that script into /etc/e-smith/events/halt and /etc/e-smith/events/reboot.
Nothing else needs to be done. No existing scripts need to be hacked. No additional ways to trigger a shutdown or reboot need to be created.
-
Sweet, hadn't thought of doing it that way.
Just goes to show that Charlies intimate knowledge of the innner workings has its benefits.
-
That's great! Thank you Charly.
I knew it should be easy ;)
I'll implement both suggestions.