mirror of
https://github.com/Death916/minestart.git
synced 2026-04-10 03:33:43 -07:00
check for running games
This commit is contained in:
parent
e94bd9edab
commit
ffdc2dc4c1
1 changed files with 28 additions and 3 deletions
31
minestart.py
31
minestart.py
|
|
@ -6,7 +6,14 @@ import time
|
||||||
import psutil
|
import psutil
|
||||||
from subprocess import CREATE_NEW_CONSOLE
|
from subprocess import CREATE_NEW_CONSOLE
|
||||||
|
|
||||||
gameList = []
|
gameList = {"gears": "gears5.exe",
|
||||||
|
"outer_worlds": "IndianaWindowsStore-Win64-Shipping.exe",
|
||||||
|
"total_war": "Three_Kingdoms.exe",
|
||||||
|
"poe": "PathOfExile_x64Steam"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def checkgpu():
|
def checkgpu():
|
||||||
card = gpu.getGPUs()
|
card = gpu.getGPUs()
|
||||||
|
|
@ -59,6 +66,24 @@ def startminer():
|
||||||
psutil.Popen(['E:/downloads/ccminer.bat'], creationflags=CREATE_NEW_CONSOLE)
|
psutil.Popen(['E:/downloads/ccminer.bat'], creationflags=CREATE_NEW_CONSOLE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def checkgames():
|
||||||
|
|
||||||
|
game = 0
|
||||||
|
for i in gameList.values():
|
||||||
|
game = findProcessIdByName(i)
|
||||||
|
if game == []:
|
||||||
|
print(i + " is not running")
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
print(i + " is running" )
|
||||||
|
print(game)
|
||||||
|
killminer()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""def log(x):
|
"""def log(x):
|
||||||
with open('C:/Users/Death/Documents/logs/gpulog.csv', 'a') as f:
|
with open('C:/Users/Death/Documents/logs/gpulog.csv', 'a') as f:
|
||||||
f.write(str(time.ctime()) + '\n' + x + '\n')
|
f.write(str(time.ctime()) + '\n' + x + '\n')
|
||||||
|
|
@ -66,7 +91,7 @@ def startminer():
|
||||||
"""
|
"""
|
||||||
curTime = time.time()
|
curTime = time.time()
|
||||||
while True:
|
while True:
|
||||||
|
checkgames()
|
||||||
gpus = checkgpu()
|
gpus = checkgpu()
|
||||||
miner = checkminer()
|
miner = checkminer()
|
||||||
usage = str(gpu.showUtilization())
|
usage = str(gpu.showUtilization())
|
||||||
|
|
@ -81,7 +106,7 @@ while True:
|
||||||
killminer()
|
killminer()
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
|
|
||||||
if time.time() - curTime > 100:
|
if time.time() - curTime > 21600:
|
||||||
killminer()
|
killminer()
|
||||||
print('restarting')
|
print('restarting')
|
||||||
curTime = time.time()
|
curTime = time.time()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue