Questions tagged [shutdown]

This refers to the process where the system state is systematically (and preferably gracefully) changed to the fully inactive state. Usually applied to complex systems, such as database, server program, operating system, virtual machine, physical computer and the like. Bypassing the shutdown procedure (immediate termination) may cause data loss or other problems.

This refers to the process where the system state is systematically (and preferably gracefully) changed to the fully inactive state.

Usually applied to complex systems, such as database, server program, operating system, virtual machine, physical computer and the like.

Bypassing the shutdown procedure (immediate termination) may cause data loss or other problems. Once the shutdown sequence has begun it can usually be stopped only by invoking the halt method, which forcibly terminates the system.

1261 questions
15
votes
2 answers

In a spring bean is it possible to have a shutdown method which can use transactions?

In the destroy method of a spring bean I want to execute some queries to clean up some stuff in the database. Spring doesn't seem to allow this by any means I can find. The error is always something like: Invocation of destroy method failed on …
HappyEngineer
  • 4,017
  • 9
  • 46
  • 60
15
votes
3 answers

How do I get rid of Java child processes when my Java app exits/crashes?

I launch a child process in Java as follows: final String[] cmd = {""}; Process process = Runtime.getRuntime().exec(cmd); It now runs in the background. All good and fine. If my program now crashes (it is still in dev :-)) the…
Steve McLeod
  • 51,737
  • 47
  • 128
  • 184
15
votes
3 answers

How to gracefully shut down monogodb 0.8 running in docker

I am starting mongodb via the ENTRYPOINT config in a docker file. It works fine. However, when I execute: docker stop it seems to be sending a SIGTERM to the process. Which means the mongod.lock file is not cleared. How can I…
canadadry
  • 8,115
  • 12
  • 51
  • 68
14
votes
4 answers

Shut down iPhone in simulator

This might seem like a strange question, but can I actually shut down the iPhone and restart it in the iPhone simulator? I want to do this to see if my settings are saved and reloaded when the app is relaunched AFTER shutdown. Thanks
Aravind
  • 284
  • 1
  • 4
  • 10
14
votes
3 answers

java web-application initialization and shutdown

I'm trying to implements initialization and shutdown of a webapp. That includes initialization and shutdown of: Hibernate (v3.6); C3P0 (v0.9.1.2); EHCache (v2.3.0); Quartz (1.8.4); Other tasks specific to my webapp; Using Tomcat 5.5.30 and Java 6.…
ChRoNoN
  • 860
  • 8
  • 18
14
votes
4 answers

WMI to reboot remote machine

I found this code on an old thread to shutdown the local machine: using System.Management; void Shutdown() { ManagementBaseObject mboShutdown = null; ManagementClass mcWin32 = new ManagementClass("Win32_OperatingSystem"); …
Stephen Murby
  • 1,407
  • 3
  • 17
  • 37
13
votes
6 answers

Temporarily prevent linux from shutting down

I have a backup script that runs in the background daily on my linux (Fedora 9) computer. If the computer is shut down while the backup is in progress the backup may be damaged so I would like to write a small script that temporarily disables the…
Jon Levell
13
votes
1 answer

Why Is InterruptedException a Checked Exception?

When working with threads in Java, dealing with InterruptedException seems to be a particular thorn in my side. I appreciate the fact that it's thrown when my threads are terminated, and thus offers me a chance to cleanup. What seems odd to me is…
Andy
  • 1,663
  • 10
  • 17
13
votes
5 answers

Allow restarting Java application with JMX monitoring enabled immediately

I have a Java application with JMX monitoring enabled like this: -Dcom.sun.management.jmxremote.port=9999 \ // some other properties omitted But when I try to restart the application, sometime I got an error says the JMX port number is already in…
George
  • 4,029
  • 2
  • 22
  • 26
13
votes
1 answer

What happens if System.exit is called from a shutdown hook?

I have a rather complicated shutdown in Java - there's a lot of clean up work to do. In particular I'm trying to figure out how to error handle from a shutdown hook thread. My code includes this currently: try { return shutdownPromise =…
djechlin
  • 59,258
  • 35
  • 162
  • 290
13
votes
4 answers

Determine exit status within the java shutdown hook thread

I would like to determine the exit status of the process during the shutdown hook runtime. I want to have a logic which is based on the status code (0 or nonzero) (ex: if zero do nothing else nonzero send an alert email) Do you know how I can get…
Kostas
  • 702
  • 3
  • 8
  • 17
12
votes
4 answers

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? 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…
Dan
  • 33,953
  • 24
  • 61
  • 87
12
votes
2 answers

Remotely shutdown/reboot Linux boxes without SSH?

I need to remotely shutdown and reboot Linux (Ubuntu) machines without logging into them (otherwise simple commands can do the job). The machines are just cheap PCs so there are no special power management hardware installed (though they can…
jasxun
  • 571
  • 1
  • 5
  • 11
12
votes
4 answers

Close TCP connection on Linux ungracefully

Is there a way to programmatically close a TCP connection in C/C++ ungracefully on Linux? For testing, I would like to simulate the case when an endpoint is just powered down without transmitting any FIN and/or RST, and neither flushing any buffers.
Andre K
  • 185
  • 1
  • 10
12
votes
5 answers

Detect pending linux shutdown

Since I install pending updates for my Ubuntu server as soon as possible, I have to restart my linux server quite often. I'm running an webapp on that server and would like to warn my users about the pending restart. Right now, I do this manually,…
iGEL
  • 16,540
  • 11
  • 60
  • 74