Force application close on system shutdown

In your FormClosing event check the FormClosingEventArgs’ CloseReason property to see why the window is closing down. If it is CloseReason.WindowsShutDown then don’t show your dialog and do not cancel the closing of your form. private void MyForm_FormClosing(object sender, FormClosingEventArgs e) { // Verify that we’re not being closed because windows is shutting down. if … Read more

Programmatically switching off Android phone

As CommonsWare already said that this is not possible in an Ordinary SDK Application. You need to sign your app with the System Firmware Key. But it’s possible for your app with Root privileges. Try using the following code (if you have SU access): Shutdown: try { Process proc = Runtime.getRuntime() .exec(new String[]{ “su”, “-c”, … Read more

How do I shutdown JBoss AS 7 server?

For some reason the JBoss team decided to reorganize the scripts between minor revision upgrades. In any case, jboss-cli.sh is the replacement for jboss-admin.sh (they are for all intents and purposes the exact same script). So your new shutdown command is: ./jboss-cli.sh –connect command=:shutdown

Stop MySQL service windows

On Windows If you are using Windows Open the Command Prompt and type To Stop MySQL Service: net stop MySQL80 To Start MySQL Service: net start MySQL80 On Linux # /etc/init.d/mysqld start # /etc/init.d/mysqld stop # /etc/init.d/mysqld restart Fedora / Red Hat also support this: # service mysqld start # service mysqld stop # service … Read more

How to simulate Windows shutdown for debugging?

There is a tool named Restart Manager (rmtool.exe) in the Microsoft’s Logo Testing Tools for Windows, which can be used to send shutdown and restart messages to a process. Logo testing tools can be downloaded here: http://download.microsoft.com/download/d/2/5/d2522ce4-a441-459d-8302-be8f3321823c/LogoToolsv1.0.msi Then you can simulate shutdown for your process: rmtool.exe -p [PID] -S where [PID] is the process ID. … Read more