shutdown

What is the proper way of handling logoff / shutdown / restart when the application has unsaved data?

In WPF App.Current.SessionEnding must return in a few seconds, otherwise the "application does not respond" window appears. So the user can't be asked in this event handler to save his data, because the user's response takes longer than a few seconds. I thought a solution would be to cancel the logoff / shutdown / restart, and resume it...

Windows shutdown dialog

Is there a way to bring up the Windows XP shutdown dialog (the one with the three buttons – Suspend, Shutdown, Restart and Hibernate when Shift is pressed) using any language (preferred: C/C++, VB, Haskell, batches)? I think I can load the msgina.dll in my C++ program, but I dunno what to do next – what function in the dll is used to sh...

How to properly kill local threads owned by a webapp running on tomcat instructed to shutdown

A backend webapp is deployed on a Tomcat 6 servlet container. In the webapp, several monitoring threads are started. The problem is with shutdown. How do I know that the webapp is requested to shutdown? How should I handle this in my threads? Currently my thread is implemented as below. When the servlet is instructed to shutdown (sh...

How do I shutdown the computer?

How to shutdown my computer using C#? ...

Shutdown the computer using assembly

How can I shutdown the computer using only assembly code? ...

preventing vista shutdown loggoff API showing

I want to stop the shutdown / log off API which appears when you have programs open to confirm a shutdown/logoff. I have an application already that send a reason to the API. I know this is bad practice but I really need to override / cancel the shutdown with out displaying the API after 5 seconds. is there any way to hack this or ru...

How can I run a Perl script as a system daemon in linux?

What's a simple way to get a Perl script to run as a daemon in linux? Currently, this is on CentOS. I'd want it to start up with the system and shutdown with the system, so some /etc/rc.d/init.d integration would also be nice, but I could always add a custom line to /etc/rc.d/rc.local. ...

What is the exception thrown in a running .NET thread when Windows shuts down?

The exact exception message would be helpful, too. Thanks. ...

Apache shutting down unexpectedly

Hello, I have a mongrel server running behind Apache. It works fine; however, every now and then the Apache server shuts downs seemingly by itself. I'm not sure if there is configuration issue or if it's an attack. Here is Apache error log: [Thu Apr 30 02:15:07 2009] [notice] SIGHUP received. Attempting to restart [Thu Apr 30 02:15:0...

Windows will not shutdown programmatically when logged off

I have an application that is launched from within a service using a local administrator account. This application is accessible by a web browser and the host PC can be shut down through this interface. If a user is logged into the host PC and I browse to it and shut it down, the application exits and shuts down the PC as I would expect...

Force shutdown of iPhone

Hi guys, Is it possible to force the iPhone to shutdown (programmatically, of course)? Thanks in advance! ...

Linux ACPI Configuration

In my Fedora Core Linux (kernel 2.6.16.11), I've been trying to test the auto-shutdown mechanism associated with the CPU temperature. It does not automatically shutdown properly. If my current processor temperature is 50 C and I set my ACPI configuration to shutdown at 55 C by executing the following commands at the prompt: echo -n "5...

Method that gets called on module deletion in Python

Is there a method that I can add to my module, which will get called when destructing the class? Update: We have a simple class which has only static member functions and needs to clean up the database connection when unloading the module. was hoping there would be a __del__ method either for modules or classes that don't have instances...

How to detect whether Windows is shutting down or restarting

I know that when Windows is shutting down, it sends a WM_QUERYENDSESSION message to each application. This makes it easy to detect when Windows is shutting down. However, is it possible to know if the computer going to power-off or is it going to restart after Windows has shutdown. I am not particularly hopeful, considering the document...

SetProcessShutdownParameters for windows services (Windows XP)

I have a few (arbitrary) windows services that I would like to stop down in a specific order on shutdown (e.g., stop A, then stop B, then stop C). I know that service dependencies aren't respected in Windows XP (they are in Vista), but various Internet'ing indicates that the shutdown order may respect the priorities set by SetProcessShu...

Best Way to Gracefully Shutdown a Java Command Line Program

Hello, I'm interested in different approaches to gracefully shutting down a Java command line program. Sending a kill signal is not an option. I can think of a few different approaches. Open a port an wait for a connection. When one is made, gracefully shutdown. Watch for a file to be created, then shutdown. Read some input from th...

java.rmi.UnmarshalException: --- Cannot shutdown jboss

in trying to shutdown jboss it’s giving me an error and won’t shutdown. Any ideas what this means? /var/app/comcast/jboss-4.2.2.GA/bin/shutdown.sh -S Exception in thread "main" javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.EOFException...

Disable ACPI power button

Hi, is there any simple way to disable processing ACPI power button events (Shutdown) temporarily using the Windows API in Visual C++, so the user isn't able to shut down the computer using the power button? ...

JAVA: how to call a method when the process has been stopped (is it even possible?)

Hi all, I want it so when my users start my program from the command line and then kill the process (ctrl+c, for example) the program will shutdown gracefully by closing all its connections. Is this even possible? I can't just have it call a method upon closing like a GUI can? This program has no GUI. Please let me know. Thanks, jb...

Handling System Shutdown in WPF

How can I override WndProc in WPF? When my window close, I try to check if the file i'm using was modified, if so, I have to promt the user for "Do you want to save changes?" message, then close the file being used and the window.However, I cannot handle the case when user restarts/shutdown/logoff when my window is still open.I cannot ov...