Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit script #34

Open
MichalRybecky opened this issue Oct 19, 2020 · 4 comments
Open

Exit script #34

MichalRybecky opened this issue Oct 19, 2020 · 4 comments

Comments

@MichalRybecky
Copy link

Hello!
I have added the temp.sh script to run as pre-run script for games through Lutris. It works great, but I have problem that I don't know how to exit it so the fans would come back to normal mode. I have tried adding post-exit bash scripts that had only pkill temp, trying kill -INT $(pgrep temp.sh) or even looking into the temp.sh script. Because I have very little knowledge about this, I wasn't able to find anything useful there.
Is there any way that I can exit this script from other bash script?
Thanks a lot, love your work btw!

@nan0s7
Copy link
Owner

nan0s7 commented Oct 21, 2020

pkill temp will certainly stop the script, but it won't trigger the finish() function, which resets all the values to their defaults. But kill -INT $(pgrep temp) works fine for me (you only need the extra .sh if you have another process called temp, so it's probably wise just to use the full temp.sh).

The finish() function does activate upon an INT kill, so that's why the regular pkill command doesn't activate it.

If the kill -INT $(pgrep temp.sh) isn't working, double check that you're not running temp.sh with sudo permissions.

If that still doesn't work, feel free to show me the code you're using and how you've set it up. :)

PS. if it's not working, check if pgrep temp or pgrep temp.sh returns anything (should be a number).

@MichalRybecky
Copy link
Author

So the way I have set it up is that I have created additional script called temp_kill.sh with nothing more than kill -INT $(pgrep temp.sh) in it. Lutris runs this script when the game is closed.

I have done some more testing and turns out that kill -INT $(pgrep temp.sh) does work only when I manually run it using terminal, or when I run the temp_kill.sh script. If the script is activated by Lutris at the game exit, it kills the command but probably does not activate finish() function (not sure how to check if this function is activated or not, but since it doesn't come back to auto mode, I would assume it doesn't).

I have played with pgrep temp.sh as well. When the game starts, I can hear my fans speed up (I have set fan speed to 100 for testing so I am able to hear it) and this command returns a numeric value. If I run temp_kill.sh script while the game runs, it kills the temp.sh and fans return to auto mode. pgrep temp.sh does not return any value anymore. But if I exit the game, Lutris executes temp_kill.sh, pgrep temp.sh does not return any value, but fans do not return to auto mode, they are still doing 100% speed (so probably finish() function wasn't activated).

Not really sure why is this possible, maybe there is a problem with how Lutris runs these scripts, as when I run the kill script manually, it works. My thoughts are to implement the finish() function to my temp_kill.sh script, although that might not be necessary if I can kill the script properly.

@nan0s7
Copy link
Owner

nan0s7 commented Oct 27, 2020

Sorry for the delay in responce; had a busy week.

Yeah it really does sound like Lutris isn't executing the script properly. Perhaps it's running the script in another session of some sort, and can't see the temp.sh script?

What you could do is have a script that manages, or launches beside Lutris. Then have it watch and wait until Lutris closes and can kill the script. Unless there is some sort of option in Lutris to set the working directory or something like that. To be honest I don't know enough about Lutris; I'll have to look into it when I'm not busy.

Sorry this is a bit difficult to get working how you want :/

@MichalRybecky
Copy link
Author

No worries!
I will spend some time to (hopefully) find some reasonable solution. When I do, I'll be sure to post it here.
Thanks for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants