Question — Execute script when process runs?

Started by LookHangars, March 23, 2022, 03:33:55 PM

Previous topic - Next topic

LookHangars

So I've been eyeing Process Lasso for a while and finally gave it a purchase today.  I've read much of the documentation and have a pretty good understanding of what it can do, and plan to put it to use with managing processes on my system as I like.

I have a question:  Is there any way to have Process Lasso notice when a certain process starts and then execute a script?  If so, is what is the "right way" to do this?

I noticed that there is a "launch a program" option in the Watchdog feature.  Would it make sense to set a rule like "process uses at least 0% CPU for 0 seconds" to get a script to run, or is there a better way to do it?  (If I did that, would the script run once, or would it be triggered continuously?)

Use case background —
I am very appreciative of Process Lasso's ability to set the Windows power profile when certain programs run and I will be putting that to use.  However, I am running Dell laptops and I also would like to change the laptop's "thermal mode".  Dell has a few different modes that affect the system's fan behavior which exist independently of the Windows power profile.  I wrote a command-line tool that can switch the thermal mode, I'm just looking for a way to automatically fire it automatically when certain programs run.

I also have one system that I use for gaming which has a boatload of RAM, and I've found that game loading times and stuttering behavior are reduced for some games if I pre-cache the game files into RAM, so I wrote a simple program to do that.  So, I'm also interested to see if I can get Process Lasso to kick off this program with certain parameters when I launch a particular game.


That's all, thanks for the great work!

Jeremy Collake

#1
Presently, this type of action is possible, but a little awkward.

Quote from: Aaron44126 on March 23, 2022, 03:33:55 PM
Would it make sense to set a rule like "process uses at least 0% CPU for 0 seconds" to get a script to run, or is there a better way to do it?  (If I did that, would the script run once, or would it be triggered continuously?)

You have the right idea. I recommend: Virtual memory (any metric) > 0 MB for 0 seconds.

The script will sometimes be relaunched, triggered again by the same instance. This will occur when the Lasso config/rules are changed (prolasso.ini written to), active config profile switched, Governor restarted, and potentially at other times. Your script will need be tolerant of that. In your case, it doesn't sound like it'd be a problem.

You aren't the first to ask about such a capability, and we do have plans to improve this. I'll update this thread when that work progresses.

I'm glad to see you are making the most of Process Lasso's automation, and really appreciate the feedback. If you have any other questions or ideas, don't hesitate to post them!
Software Engineer. Bitsum LLC.

LookHangars

Awesome, thanks...  I'll play with it and I'm sure I'll be able to find something that works.  I might do a little bit of custom work to support my use case (i.e. maybe a simple background program that watches for Windows power profile changes and uses that to drive changes to the Dell thermal mode... then I could just use the power profile automation features from Process Lasso to drive both).

Quote from: Jeremy Collake on March 24, 2022, 11:08:25 AMI'm glad to see you are making the most of Process Lasso's automation, and really appreciate the feedback. If you have any other questions or ideas, don't hesitate to post them!

I guess if I had a "wishlist" it would basically be to be able to set up actions similar to Watchdog rules that fire automatically (once) when a matching process starts, and also when a matching process terminates.  ...Though I don't know if I would use any of the Watchdog actions other than "run a program" as most of the rest can be handled just by setting rules for priority/affinity/etc..

Otherwise, this seems to be everything that I would want in a "process management solution".  I'll let you know if anything else occurs to me while putting it to use.

(I had stared cobbling together my own solution for managing process priority/affinity/etc. before I found your tool.  Glad I didn't get terribly far down that road, ha.)

Thanks again!

stevediaz

Exciting times! Finally took the plunge and got Process Lasso. Been digging into the documentation, and it's a game-changer for managing processes on my system. Got a question for the community: Any way to make Process Lasso trigger a script when a specific process starts? Considering using the "launch a program" option in Watchdog, like setting a rule for CPU usage, but wondering if there's a better approach. Thanks for sharing thishttps://community.bitsum.com/forum/index.php?topic=10276.0

Jeremy Collake

Welcome aboard!

The Watchdog 'launch a program' action is the only way to accomplish that with Process Lasso.

When adding the rule, be sure to click the link to change the Governor deployment type, as shown at the bottom of the attached screenshot.

If you run into any troubles, let us know!

Software Engineer. Bitsum LLC.

Butch1939

Quote from: stevediaz on February 14, 2024, 07:16:45 AMExciting times! Finally took the plunge and got Process Lasso. Been digging into the documentation, and it's a game-changer for managing processes on my system. Got a question for the community: Any way to make Process Lasso trigger a script when a specific process starts? Considering using the "launch a program" option in Watchdog, like setting a rule for CPU usage, but wondering if there's a better approach. Thanks for sharing thishttps://community.bitsum.com/forum/index.php?topic=10276.0 soccer skills world cup

This is exciting news! I've been considering Process Lasso myself, and your experience is definitely pushing me closer to trying it.



emmausa

#6
I believe that with the information you share, it will bring a lot of value to the readers and I hope that they will absorb the good and useful things.