How to force a reboot?

S

ShadowTek

I have an application that hangs occationally, and I need to script a
forced reboot. I tried to manually use "shutdown -r -f", but it didn't
work. I then manualy closed all open applications with thier GUI close
program buttons and that worked just fine.

I thought that the whole purpose of the "-f" switch was to deal with stuck
applications?
 
S

ShadowTek

My suspicion is that cmd shutdown doesn't flush
the filesystem, from the time it takes coming up
again, at least under XP Home, so I don't use it.
I gather it's busy recovering from the journaling.

Can't help with the gui question though.

So what's the point of having a "-f" switch if it doesn't really work?
 
W

who?

ShadowTek said:
I have an application that hangs occationally, and I need to script a
forced reboot. I tried to manually use "shutdown -r -f", but it didn't
work. I then manualy closed all open applications with thier GUI close
program buttons and that worked just fine.

I thought that the whole purpose of the "-f" switch was to deal with stuck
applications?

perhaps you need to specify a time to shutdown .. like so:
shutdown.exe -s -f -t 00
 
P

philo

ShadowTek said:
I have an application that hangs occationally, and I need to script a
forced reboot. I tried to manually use "shutdown -r -f", but it didn't
work. I then manualy closed all open applications with thier GUI close
program buttons and that worked just fine.

I thought that the whole purpose of the "-f" switch was to deal with stuck
applications?

Your syntax is wrong,
you have used the *nix notation.


With Windows it is a "switch"

http://www.ss64.com/nt/shutdown.html
 
S

ShadowTek

perhaps you need to specify a time to shutdown .. like so:
shutdown.exe -s -f -t 00

No, without specifying a time, the default is set to 30 seconds. When I
normally do it this way, it works just fine. But, that last time I tried
it, it started the countdown at 30 and then just froze.
 
B

Big_Al

ShadowTek said:
I have an application that hangs occationally, and I need to script a
forced reboot. I tried to manually use "shutdown -r -f", but it didn't
work. I then manualy closed all open applications with thier GUI close
program buttons and that worked just fine.

I thought that the whole purpose of the "-f" switch was to deal with stuck
applications?

%windir%\System32\shutdown.exe -s -t 0

-s = shutdown
-t = time to wait = 0 seconds.

%windir%\System32\shutdown.exe -r -t 0

-r = restart
-t = time to wait = 0 seconds.
 
S

ShadowTek

Post back if it does not work...
but I expect no problems!

I correctly tried "shutdown /r /f" before with a previous version of this
program, but it would freeze at the "Saving System Settings..." part of the
shutdown process. But it would always hang at that point, even if I tried
to manually reboot through the GUI.

This latest version of the offending program doesn't seem to interfere with
the shutdown process in the same way. It will hang at the "Saving System
Settings..." screen for a minute and then it will shutdown normally.

So I'll have to wait for it to have another glitch before I can test it
again.


Btw, the offending program is Compuserve dailup connection software.
 
P

philo

ShadowTek said:
I correctly tried "shutdown /r /f" before with a previous version of this
program, but it would freeze at the "Saving System Settings..." part of the
shutdown process. But it would always hang at that point, even if I tried
to manually reboot through the GUI.

This latest version of the offending program doesn't seem to interfere with
the shutdown process in the same way. It will hang at the "Saving System
Settings..." screen for a minute and then it will shutdown normally.

So I'll have to wait for it to have another glitch before I can test it
again.


Btw, the offending program is Compuserve dailup connection software.


Aha!


It could *possibly* be due to some small glitch in the modem or it's
software.
If it were my machine, I'd try a different modem.

Heck I have a box of spare modems !
 
S

ShadowTek

Aha!


It could *possibly* be due to some small glitch in the modem or it's
software.
If it were my machine, I'd try a different modem.

Heck I have a box of spare modems !

Yeah, but I just bought this serial modem so that I could use it with
Ubuntu. I've got several Win-modems lying around too, but I need something
that can be used by OSs other than Windows. I tried all the Lin-modem
drivers, but they haven't come up with anything functional for the Win-
modems that I have.

I'm content to simply script a reboot and program restart in order to
automatically deal with the problem once it has been detected. If I can get
it to reboot successfully, then that's good enough for me.

Compuserve is a real pain in the ass, but it's the only local dailup ISP
that doesn't smother you with connection time or bandwith restrictions. If
it wern't for the need for proprietary handshakes, then I could simply use
native Linux apps to connect to my ISP.
 
S

ShadowTek

Compuserve is a real pain in the ass, but it's the only local dailup
ISP that doesn't smother you with connection time or bandwith
restrictions. If it wern't for the need for proprietary handshakes,
then I could simply use native Linux apps to connect to my ISP.

OK, the glitch happened again and I had a chance to try things out. It
turns out that using dashes (-) IS the correct syntax for shutdown command
options, and I did in fact do things correctly in my first post.
(shutdown /f /r does not even work)

So, I tried "shutdown -f -r" again, and the same things happended: the
shutdown dialog box that displays the start of the default 30 second
countdown appeared, but then it froze and never progressed. I tried to
abort the shutdown with "shutdown -a", but nothing happened, and any
further attempts to initiate shutdown commands other than "-a" would return
the error that a shutdown was already in progress.

So, I tried to kill the Compuserve software process by using
"kill -s sigkill -p wcs2000.exe", which successfully killed that process.
The previously frozen shutdown dialog disappeared, and the shutdown process
was apparently aborted.

After all of this, I then tried to shutdown again by simply using
"shutdown -r", which finally worked this time.


So, the lesson to be learned seems to be that shutdown.exe doesn't want to
work at all until the Compuserve process "wcs2000.exe" is first killed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top