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.
1,264
questions
685
votes
10
answers
2.5m
views
How do I shutdown, restart, or log off Windows via a bat file?
I've been using Remote Desktop Connection to get into a workstation. But in this environment, I cannot use the power options in Start Menu. I need an alternative way to shutdown or restart.
How do I ...
570
votes
19
answers
467k
views
How do I exit a WPF application programmatically?
How is one supposed to exit an application such as when the user clicks on the Exit menu item from the File menu?
I have tried:
this.Dispose();
this.Exit();
Application.ShutDown();
Application.Exit();
...
159
votes
17
answers
271k
views
How to shut down the computer from C#
What's the best way to shut down the computer from a C# program?
I've found a few methods that work - I'll post them below - but none of them are very elegant. I'm looking for something that's ...
105
votes
4
answers
203k
views
How can I get the Windows last reboot reason
I'd like to know what is the Windows API function (if any exists) that provides information about the last Windows reboot source. There are three main possible causes:
The computer crashed on a blue ...
90
votes
14
answers
127k
views
Android Service Stops When App Is Closed
I am starting a service from my main Android activity as follows:
final Context context = base.getApplicationContext();
final Intent intent = new Intent(context, MyService.class);
startService(intent)...
72
votes
9
answers
109k
views
Shutting down a computer
Is there a way to shutdown a computer using a built-in Java method?
61
votes
4
answers
72k
views
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 ...
58
votes
3
answers
66k
views
How to shutdown an ExecutorService?
Whenever I call shutdownNow() or shutdown() it doesn't shut down. I read of a few threads where it said that shutting down is not guaranteed - can someone provide me a good way of doing it?
57
votes
7
answers
38k
views
How to get shutdown hook to execute on a process launched from Eclipse
I have a shutdown hook in my application (created using Runtime.getRuntime().addShutdownHook). However if I launch the application from within Eclipse, when it is shut-down the shutdown hook doesn't ...
54
votes
17
answers
233k
views
Stop MySQL service windows
I am developing a website and need to refresh data. Therefore MySQL must be stopped.
How can I stop the service?
When I look at control panel services it is started without stop or restart option.
54
votes
5
answers
16k
views
How to simulate Windows shutdown for debugging?
I have an issue with my application when Windows shuts down - my app isn't exiting nicely, resulting in the End Task window being displayed. How can I use the debugger to see what's going on?
Is ...
49
votes
17
answers
71k
views
Android emulator won't shut down
The emulator starts up fine. But when you long-press the power button (or F7) and choose "Power off", it displays a "Shutting down" message which remains on-screen forever and the emulator won't ...
49
votes
3
answers
33k
views
App shutdown with EXC_RESOURCE, WAKEUPS exception on iOS 8 GM
Does anyone know what this kind of exception is on iOS 8?
=== from crash report ===
Exception Type: EXC_RESOURCE
Exception Subtype: WAKEUPS
Exception Message: (Limit 150/sec) Observed 206/sec over ...
46
votes
4
answers
78k
views
How to cancel shutdown on Linux? [closed]
I'm familiar with and use shutdown in Linux, and typically just do
> shutdown -h now
But is there a way to stop shutdown from happening, say if I aim to shutdown 10 minutes from now and then in 5 ...
44
votes
6
answers
78k
views
How do I shutdown JBoss AS 7 server?
I recently updated from jboss-as.7.1.0.CR1b to jboss-as.7.1.0.Final and want to shutdown running instance from the console. In previous versions the command
$JBOSS_HOME/bin/jboss-admin.sh --connect ...
43
votes
6
answers
151k
views
Executing a batch script on Windows shutdown
Is there any way, in Windows 7 Professional, to run a batch script (e.g., a .BAT file) when the user clicks on "shutdown" (not a batch file scheduled to shut down the machine, just one that runs only ...
40
votes
4
answers
47k
views
shutdown hook for java web application
I need to save some data preferrably when the java web application is stopped, or when tomcat is stopped. how can this be done?
Edit:
any drawback if I use the jvm shutdown hook?
37
votes
6
answers
63k
views
Programmatically switching off Android phone
Can we switch off an Android phone programmatically?
I am using following snippet but it didn't work for me.
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Activity....
32
votes
5
answers
10k
views
Force application close on system shutdown
I have a Windows Forms application that when the Main Window is closing, it displays a basic dialog box, confirming the action. If the user decides to cancel the application exit is cancelled.
...
26
votes
7
answers
73k
views
Facing some issues regarding tomcat startup and shutdown on ubuntu 10.04
I am facing some issues regarding tomcat startup and shutdown.
I am using
Tomcat v.6.0.32 (using the extracted the bundle downloaded from Apache website and not the one distributed by Ubuntu 10.04)
...
25
votes
1
answer
91k
views
Windows 7 remote shutdown: Access denied(5) [closed]
I am trying to force a remote shutdown from my laptop to my PC:
machine> shutdown -m \\192.168.2.10 -s -f -t 0
192.168.2.10: Access denied(5)
I am in a WLAN/LAN environment:
Laptop is in WLAN ...
25
votes
7
answers
38k
views
Best Way to Gracefully Shutdown a Java Command Line Program
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 and ...
24
votes
7
answers
29k
views
How do i shutdown my heroku app?
I've slowly battled through to the point where I have a working Grails app on Heroku. I'm going to bed now so I want to shut it down so I don't continue to use up my 750 free hours of my Dyno. It is ...
23
votes
0
answers
8k
views
How to disable the "Chromium didn't shut down correctly" message? Chromium 17, Ubuntu 10.04 [closed]
I am running Chromium in a kiosk-like environment and if the computer is powered off forcefully while Chromium is running, the next time it boots it will display the message "Chromium didn't shut down ...
22
votes
3
answers
28k
views
handling phone shutdown event in android
Could you post a simple code to handle shutdown event.
I need manifest and receiver.
I need the following:
I have a service running in background and I want to detect phone shutting down in order to ...
22
votes
2
answers
22k
views
How to properly shutdown java ExecutorService
I have a simple java ExecutorService that runs some task objects (implements Callable).
ExecutorService exec = Executors.newSingleThreadExecutor();
List<CallableTask> tasks = new ArrayList<&...
21
votes
10
answers
28k
views
Shutdown the computer using assembly
How can I shutdown the computer using only assembly code?
21
votes
1
answer
26k
views
gRPC: What is the recommended way to shut down an asynchronous server in C++?
I have a gRPC server that hosts two asynchronous services ("Master" and "Worker"), and I would like to implement graceful shutdown for the server. Each service has its own grpc::CompletionQueue.
...
20
votes
4
answers
18k
views
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 ...
20
votes
2
answers
8k
views
What happens when the JVM is terminated?
What happens when the JVM is terminated with System.exit(0) or ^C or anything of that kind? I read things like "the process is just blown away" and "every single thread is stopped",...
19
votes
11
answers
106k
views
How to shutdown a computer using Python
I've written a Python script which should eventually shutdown the computer.
This line is a part of it :
os.system("shutdown /p")
It makes some sort of a shutdown but remains on the turn-on Windows ...
19
votes
4
answers
10k
views
Best way to shutdown an OSGi Container (specifically equinox)
I'm looking for a best practice on shutting down an OSGi container.
Currently we are using a small launcher app which calls EclipseStarter.startup() and installs some core bundles. After that the ...
19
votes
5
answers
14k
views
How do you cleanly abort a Delphi program?
I've got a program that's having some trouble during shutdown, raising exceptions that I can't trace back to their source. It appears to be timing-related and non-deterministic. This is occurring ...
19
votes
2
answers
12k
views
How do I gracefully shutdown the Tokio runtime in response to a SIGTERM?
I have a main function, where I create a Tokio runtime and run two futures on it.
use tokio;
fn main() {
let mut runtime = tokio::runtime::Runtime::new().unwrap();
runtime.spawn(...
18
votes
2
answers
9k
views
twisted: catch keyboardinterrupt and shutdown properly
UPDATE: For ease of reading, here is how to add a callback before the reactor gets shutdown:
reactor.addSystemEventTrigger('before', 'shutdown', callable)
Original question follows.
If I have a ...
17
votes
9
answers
75k
views
Shutdown Windows machine from linux terminal [closed]
I am running an application on linux machine. By giving the ip address of a windows machine as input, the application must shutdown the windows machine. If the machines run the same OS it is very easy ...
17
votes
9
answers
22k
views
How to use command to shutdown grails run-app
After executing grails run-app, except using Ctrl + C", is there a command to shutdown it?
17
votes
5
answers
27k
views
How to shutdown Linux using C++ or Qt without call to "system()"?
I want to shutdown an Embedded Linux when a close button is pushed on the UI. I know I can do it with a call to system:
system("shutdown -P now");
Ref: Link
But knowing that using system is not ...
17
votes
7
answers
61k
views
Jetty throws NoClassDefFoundError: org/eclipse/jetty/util/FutureCallback on shutdown
Our maven build throws at the end of the build of the shutdown of jetty a NoClassDefFoundError that I do not understand. Does anyone have an idea where this is comming from and how to fix it?
Here is ...
17
votes
2
answers
15k
views
How to send Shutdown command to process through CMD Prompt on Windows
I'm currently working as software developer and I'm using bunch of tools, so I need to close them all when finished with the work. So what I have done I have created batch file with the tskill command ...
17
votes
3
answers
22k
views
Win32 API analog of sending/catching SIGTERM
Under POSIX OS there is signal API that allows to send a signal to process to shut it down
with kill and you can catch it with sigaction and do what you need;
However, Win32 is not POSIX system, so:
...
17
votes
3
answers
21k
views
Shutdown netty programmatically
I'm using netty 4.0.24.Final.
I need to start/stop netty server programmatically.
On starting the server, the thread gets blocked at
f.channel().closeFuture().sync()
Please help with some hints ...
16
votes
3
answers
16k
views
How to shutdown Derby in-memory database Properly
I'm using derby as an embedded database. Furthermore, I'm using it's in-memory database option for my unit tests.
What I can't figure out is how to properly shut down (A quick look at the code) the ...
16
votes
1
answer
14k
views
Using JavaFX Application.stop() method over Shutdownhook
So im using shutdownhook to clean up. But since its not always guaranteed that shutdownhooks thread executes, should i just push this code onto JavaFX Application Thread (method stop()), which ...
15
votes
6
answers
27k
views
Close a WP7 application programmatically? [duplicate]
Possible Duplicate:
Windows Phone 7 close application
How do I programmatically close a WP7 application?
15
votes
1
answer
6k
views
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 ...
15
votes
3
answers
10k
views
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 = {"<childProcessName>"};
Process process = Runtime.getRuntime().exec(cmd);
It now runs in the background. All good and fine.
...
15
votes
2
answers
30k
views
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 ...
15
votes
3
answers
15k
views
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 <containerid>
it seems to be sending a SIGTERM to the process. Which means ...
15
votes
1
answer
6k
views
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 ...