mirror of
https://github.com/Death916/minestart.git
synced 2026-04-10 03:33:43 -07:00
formatting
This commit is contained in:
parent
5c06a83849
commit
718b5f46a4
1 changed files with 8 additions and 16 deletions
22
minestart.py
22
minestart.py
|
|
@ -17,14 +17,14 @@ def checkgpu():
|
||||||
return 'isavailable'
|
return 'isavailable'
|
||||||
|
|
||||||
if isavailable == [0]:
|
if isavailable == [0]:
|
||||||
print("cant mine")
|
print("gpu in use")
|
||||||
time.sleep(5)
|
gpu.showUtilization()
|
||||||
|
time.sleep(500)
|
||||||
|
|
||||||
return 'notavailable'
|
return 'notavailable'
|
||||||
|
|
||||||
|
|
||||||
def findProcessIdByName(processName):
|
def findProcessIdByName(processName):
|
||||||
|
|
||||||
listOfProcessObjects = []
|
listOfProcessObjects = []
|
||||||
|
|
||||||
# Iterate over the all the running process
|
# Iterate over the all the running process
|
||||||
|
|
@ -47,35 +47,27 @@ def checkminer():
|
||||||
else:
|
else:
|
||||||
return "running"
|
return "running"
|
||||||
|
|
||||||
|
|
||||||
def killminer():
|
def killminer():
|
||||||
miner = findProcessIdByName('ccminer.exe')
|
miner = findProcessIdByName('ccminer.exe')
|
||||||
pid = miner[0]['pid']
|
pid = miner[0]['pid']
|
||||||
psutil.Process(pid).kill()
|
psutil.Process(pid).kill()
|
||||||
print('killed miner')
|
print('killed miner')
|
||||||
|
|
||||||
|
|
||||||
def startminer():
|
def startminer():
|
||||||
psutil.Popen(['E:\downloads\ccminer.bat'], creationflags=CREATE_NEW_CONSOLE)
|
psutil.Popen(['E:\downloads\ccminer.bat'], creationflags=CREATE_NEW_CONSOLE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
gpus = checkgpu()
|
gpus = checkgpu()
|
||||||
miner = checkminer()
|
miner = checkminer()
|
||||||
if gpus is 'isavailable' and miner is 'notrunning':
|
if gpus is 'isavailable' and miner is 'notrunning':
|
||||||
print('can start miner')
|
print('starting miner')
|
||||||
startminer()
|
startminer()
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
if gpus is 'isavailable' and miner is 'running':
|
if gpus is 'isavailable' and miner is 'running':
|
||||||
killminer()
|
killminer()
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
#kill miner
|
|
||||||
|
|
||||||
#TODO: check for games running probably best way is to make a list of all games and check against list
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##TODO:check for games running probably best way is to make a list of all games and check against list
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue