Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I detect when a specific wine program is closed?
#1
I am trying to make a bash script which when it runs, it will get the current resolution, set the resolution to 1024x768 and then launch the wine prefix/game. Once the game is closed, it will restore the resolution.

I am having trouble since I cannot detect when the EXE is closed. I know Linux has this PID system but any windows program in PID is named "winedevice" which can be any windows application. How will I edit my script to detect when the hcbg2.exe file is closed and then therefore continue the script and restore the resolution to the $resolution variable?


Code:
#!/bin/bash

resolution=($(xrandr | grep '*'))
resolution=${resolution[0]}
xrandr -s 1024x768
env WINEPREFIX="/usr/share/Applications/Hoyle Board Games" wine "C:\windows\command\start.exe" /Unix "/usr/share/Applications/Hoyle Board Games/drive_c/SIERRA/HCBG2/hcbg2.exe"
wait
xrandr -s $resolution
Reply
#2
Code:
[color=#1c1c1c][size=small]env WINEPREFIX="/usr/share/Applications/Hoyle Board Games" wine "C:\windows\command\start.exe" /Unix "/usr/share/Applications/Hoyle Board Games/drive_c/SIERRA/HCBG2/hcbg2.exe"
sleep 5
PID=ps aux | grep hcbg2.exe | awk '{print $2}'
if PID == false
   echo "Done"[/size][/color]

This is what I got so far. Does anyone know how to have a script wait and detect when a PID is no longer running in this case if a wine/windows program is closed?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)