Solved

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

Posted on 2014-11-02
2
329 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 37

Expert Comment

by:Gerwin Jansen
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 68

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now