Article 5T6H6 Need help with wait command for .exe process possibly some other command

Need help with wait command for .exe process possibly some other command

by
Krackerjak1
from LinuxQuestions.org on (#5T6H6)
Hello. I am looking for a way to resume my script when a specific process has finished or terminated regardless of the exit code. It is a game with the program name MCM2.EXE. The problem I am having is when I close the game playonlinux gives me an error that wine has crashed, then I have to click next or cancel, then the box goes away and all is well. The issue does not have any affect on the game in any way, it's just a nuisance that I would like to correct with a kill command as soon as MCM2.EXE is no longer running. I have played around with wait but it just wants to wait for playonlinux or python. If I start the game then alt tab out and kill python the game continues to run just fine and then when I quit the game the error does not show up. But if I try to kill python in the script right after the game start command it doesn't kill because its waiting for the command to finish before executing the kill python command. So I add "&" at the end of the game start command but the problem there is I have more commands that will execute that I don't want to execute until I finish with the game.

This is my script

#!/bin/bash

sudo swapoff -a
sudo killall xscreensaver
sudo killall cinnamon
/usr/share/playonlinux/playonlinux --run "MCM2" %F &
sleep 10
sudo renice -n -15 -p $(pgrep ^MCM2.EXE$)
sudo renice -n -18 -p $(pgrep ^Xorg$)
wait $!
cinnamon-launcher &
sudo renice -n 0 -p $(pgrep ^Xorg$)
xscreensaver -no-splash &
sudo swapon -a

The above script works well. I just would like that nagging error box to go away. I have searched wine and playonlinux sites for specific answers to the error box but cant come up with a solution.

Thanks for any helplatest?d=yIl2AUoC8zA latest?i=56W2319ohm0:YC9yS97XhGg:F7zBnMy latest?i=56W2319ohm0:YC9yS97XhGg:V_sGLiP latest?d=qj6IDK7rITs latest?i=56W2319ohm0:YC9yS97XhGg:gIN9vFw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments