Forums Register Login

Shutdown (spec requires : OS/Platform independent)

+Pie Number of slices to send: Send
Hello,
I finally gave up "independant tinkering" and am hoping for a response or at least a refferal to one on this forum... I need to write a program that gets a trigger from a remote source and then shuts down...
Basically, there is a "server" which will send a simple signal to various clients (I'll probably just use plain old socket i/o for this). When the clients get this signal they will then start an orderly shutdown of the respective OS.
I would like to make this "somewhat" platform-independant as this is a program whose scope-of-use is rather large. The server actually gets triggered to shut-off all of the clients by a UPS Battery Low signal, most clients have at least 1 non-windows machine on-site hence the Platform issue and my choice of Java (I've scorned and avoided it for as long as possible, finally necessity has thrown Java upon me... That is - I am not going to setup a Linux, AIX, Solaris (on x86, SPARC etc.) environment just to get this small project rolling!
When I say "device-independant" I do not mean it in the strictest sense. If necessary, the user can state the OS and platform during the configuration of the clients (no need to auto-detect platform)...
My question: Is there a safe shutdown class/method in the Java lib (proprietary OR standard (free) libs!) or must I write seperate shutdown scripts for each platform (simple albeit a HUGE pain to develop and test)...
ThanX in advance
+Pie Number of slices to send: Send
Shutting down an OS is a particularly non-Java like thing to do. The program MUST be aware of what OS that it is running on before it can do anything. However it can figure that out by looking at
System.getProperties("os.name");
After that however, you are going to need to interact with each OS differently. Probably you would need to use some JNI. However first you could try issuing some OS specific commands using
Runtime.exec("some meaningful commands");
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 451 times.
Similar Threads
diff in c++ and java for ...
Broadcasting presence on a network
System Shutdown/Reboot etc.
IO Streams and sockets
Shutdown/Reboot
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:03:56.