Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Script / App to Restart (Kill then Start) Specific Processes if They Exceed X Amount of Memory

Posted on 2014-11-02
2
Medium Priority
?
372 Views
Last Modified: 2014-11-08
Hey Guys -

My home server hosts many different things.  By no means is it lacking in resources or out of date, but I simply have so much running on it that I'm looking for a specific solution to an issue.  

I have 2-3 processes which a few hours after start-up/reboot start using way more RAM then they need for various reasons.  What I'm needing is simple:

I'm looking for a script or application where I may designate these processes (by name, PID, whatever) and set a RAM limit for them.  At any time if they pass this limit, the process will be killed, then started back up again (with probably ~10 seconds in between.)

System Specs
- Windows 8.1 Update 1 x64
- i7 3770k / 16gb RAM
- Windows 8.1 Update 1 x64

Any thoughts or ideas for the best, most reliable & safe way to approach this?   Thanks!
0
Comment
Question by:BzowK
2 Comments
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40418222
There is no safe method to do this when you're asking to kill a process. That's why it's called killing...

A way to approach this would be using the tasklist and taskkill commands. With taskkill you could locate the processes with memory usage greater than x and then use that pid (process id) to do a taskill.

Starting again would mean that you just call the executable again that you've just killed.
0
 
LVL 71

Accepted Solution

by:
Qlemo earned 2000 total points
ID: 40418378
A common method is to setup Performance Monitoring for those processes, watching for memory consumption, and having a batch with the taskkill and process startup as action.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question