Solved

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

Posted on 2014-11-02
2
362 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 70

Accepted Solution

by:
Qlemo earned 500 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

635 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