Questions tagged [system-shutdown]

Shutting down the current operating system. This may power down the physical hardware but may also just inactivate a virtual machine.

102 questions
51
votes
3 answers

How to detect Windows shutdown or logoff

I need to detect when Windows is shutdown (or restarted) or when the user is logging off. I need to properly close the application before the application is closed. I noticed that no exit application event is raised when Windows is closing day. I…
Andrea Nagar
  • 1,173
  • 2
  • 11
  • 22
22
votes
9 answers

How to detect pending system shutdown on Linux?

I am working on an application where I need to detect a system shutdown. However, I have not found any reliable way get a notification on this event. I know that on shutdown, my app will receive a SIGTERM signal followed by a SIGKILL. I want to…
341008
  • 9,030
  • 10
  • 45
  • 84
16
votes
9 answers

shutting down computer (linux) using python

I am trying to write a script that will shut down the computer if a few requirements are filled with the command os.system("poweroff") also tried os.system("shutdown now -h") and a few others. but nothing happens when I run it, the…
user3522859
  • 163
  • 1
  • 1
  • 6
15
votes
4 answers

Run a script only at shutdown (not log off or restart) on Mac OS X

Is there any way to run a script only at shutdown? I mean, only when the computer is really shutting down to off state. This script should not run when doing just a log off or restart.
Audio01
  • 153
  • 1
  • 1
  • 5
14
votes
2 answers

How to power down the computer from a freestanding environment?

I'm making a protected-mode OS based on Intel's x86 architecture, and was looking for some information on how to power off the computer via assembly code, or something like that. Could you help me with this problem?
Carlos
  • 141
  • 1
  • 3
11
votes
3 answers

How to shutdown the machine? I'm building a tiny OS of my own

Can the hlt instruction in assembly shutdown a computer it as it halts the processor? if it can be done using what i have told, is it the right way? Can hlt shutdown the machine? start: xor ax, ax; ;clear ax mov bx, ax; ;clear bx cli…
manuhg
  • 350
  • 1
  • 4
  • 16
11
votes
3 answers

How to fix "Google Chrome did not shutdown properly" in Windows 8.1

When shutting down Windows 8.1, Google Chrome produces the error message "Google Chrome did not shutdown properly". How can I get Chrome to shut down without giving me that error message? I don't have to be logged in as a Google user.
11
votes
1 answer

Is there any API function for shutting down Windows while installing any pending updates?

I know the ExitWindowsEx() API function which simply shuts down Windows. But as far as I know, you cannot make Windows install any pending updates with it. Is there any API support for installing any pending updates (in that standard blue screen…
hkBattousai
  • 9,613
  • 17
  • 66
  • 114
10
votes
5 answers

Detecting a scheduled shutdown

I have a cmd script that will execute a set of patches, and it's designed to abort if a reboot is required to avoid patching issues. I'd also like to extend the script to abort if a reboot is scheduled (E.g. via the "shutdown" command) in order to…
Ificator
  • 101
  • 1
  • 1
  • 3
9
votes
2 answers

How to abort shutdown in Windows (XP|Vista) programatically?

I want to be able to 1. detect (and, if needed 2. abort) OS shutdown from my application, preferably by using the Windows API. I know that it is possible to abort shutdown manually using the command shutdown -a In the worst case, I could…
Piskvor left the building
  • 87,797
  • 43
  • 170
  • 220
9
votes
3 answers

C# - How to detect a Windows shutdown/logoff and cancel that action (after asking the user)

Some explanation: for a project I'm working on I have to write a program that is running in the background, detects changes to files, and uploads the modified files to a web service to make it available to others. Quite simple synchronization if it…
Sébastien Nussbaumer
  • 5,534
  • 4
  • 36
  • 54
7
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
  • 13,729
  • 9
  • 53
  • 65
7
votes
2 answers

Shutdown another System using shutdown.exe in C#?

I use the following code for shutdown the own System.It was working Fine.And I need to shut down another System, which is connected in LAN Connection. I'm unable to do it with this code. How to Shutdown another System using shutdown.exe? My OS is…
V.V
  • 865
  • 2
  • 22
  • 49
6
votes
1 answer

Arch Linux / systemd - prevent any kind of shutdown/rebboot

I'm running Arch-based Manjaro Linux and wrote myself a little update program, that starts every 7 hours and runs completely in the background. This update program is started by systemd. What I wanna know is: How can I prevent any system…
4
votes
4 answers

How do I make a hibernation batch file?

I'm trying to make a batch file that executes a simple command: shutdown -h I've created a shutdown.bat file with that exact line in it, yet when I run it, all it does is spam the command prompt like crazy. I've looked at batch file sites, @echo…
ryanscottmurphy
  • 378
  • 1
  • 2
  • 13
1
2 3 4 5 6 7