Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Remote Shutdown
Message
From
27/03/1998 18:59:07
 
 
To
26/03/1998 18:46:37
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00087503
Message ID:
00087856
Views:
27
>This week I posted an inquiry as to how to shutdown
>the machine programatically. My thanks to Ed Rauh
>who gave detailed instructions on how to do this,
>Nigel Coates who straightened me out on what was wrong
>with my implimentation and George Tasker and Emanuel
>Huybrechts. Now the clients wants to copy the system
>to the backup machine and shut it down remotely before
>the primary machine shuts itself down. Does anyone
>know how to shut down a remote machine. The idea makes
>sense as it will get everyone out a half hour earlier
>when they would just be watching machines run. Thanks

Assuming that you can determine that a machine is active via some peer-to-peer mechanism (check to see if you can open a known file on a known share on the remote machine is an easy mechanism) and that you can send a message via some sort of simple message queue (as simple as creating a file on the remote machine, and having an application running there that runs a timer and checks for that file's existance, and if it finds it, destroys it and fires off a call to the WinAPI ExitWindowsEx() function, you could do the following.

On the primary system:

If the remote system can be confirmed as running:
Perform the backup operation
When the backup operation completes:
While the remote system can be confirmed as active:
Create the message file on the remote system
Wait some amount of time greater than (remote wait time + estimated shutdown duration)
Once the remote system is confirmed as no longer active:
Kill yourself via ExitWindowsEx()

On the remote system:

While the message file doesn't exist:
Wait (remote wait time)
Once the message file exists:
Erase the message file
Kill yourself via ExitWindowsEx()

You can be a sophisticated as you like; there are obvious error handling issues (what to do if the other system isn't up when you want to back up, or what to do when the other system remains active after the message file has been created, indicating that the remote monitor has crashed out are the two obvious ones.) It is important that you use a mechanism other than accepting a receipt of the message as confirmation that shutdown has occurred, otherwise, you have the same risk as the following common office practice:

Boss: Stop playing NetDoom.
Worker: OK.



Ed
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform