Killing hung windows processes

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
jas0420
Cacti User
Posts: 91
Joined: Thu Jan 13, 2005 3:58 pm
Location: College Station, TX - USA

Killing hung windows processes

Post by jas0420 »

I just blindly stumbled into something cool that the *nix folks have that I didn't think us Windows folks did. Thought I'd shared.

I keep having problems with scripts randomly not closing. Ping scripts in particular for some reason. If I let the box go for a while, I'd log in and find 20 or more cmd.exe processes. I started using a utility called tping with a cool script from Misora (thread here: http://forums.cacti.net/viewtopic.php?t=8497). So then I started finding 20 or more tping.exe processes hung on top of the cmd.exe. It has definitely caused performance problems on the box.

Turns out, there's a utility in Windows called "taskkill" (I've verified it is in XP and 2K3... Assume it's in 2000 also, but not verified) that lets you kill a process from the command line. I am only using about 55 seconds out of the alotted 5 minutes in between Cacti cycles, so I just scheduled a new task with the simple line below in the sceduled task's "run" field.

Code: Select all

"taskkill /f /im cmd.exe /im tping.exe"


My Cacti scripts run every :00 and :05, so I just had this run every :09 and :04. Will wipe out any cmd windows that you might be working in at the time, so keep that in mind. I'll probably tone down the frequency that I run it once I'm done tinkering. There are a boat-load of switches that you can use in conjuntion with taskkill (see them with taskkill /?) to fine tune it to your needs.

'Njoy,
Jason
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

I've had similar problems in the past. I prefer to use the pstool kit from www.sysinternals.com which I run once an hour.

Code: Select all

@echo off
cd C:\Program Files\SysInternals\Pstools
pskill perl.exe
pskill php.exe
pskill cmd.exe
User avatar
TheWitness
Developer
Posts: 17061
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I have fixed both the ss_tping and ss_fping to use Cacti's internal ping constructs, which are faster and won't cause you the hung process issues so long as you are either running cmd.php or Cactid 0.8.6e.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests