Add quiet output option to stop spamming logs
This commit is contained in:
parent
494761fada
commit
3a483eff3c
@ -3,7 +3,7 @@ Description=ASRock IPMI automatic fan control
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
WorkingDirectory=/root/asrock-pwm-ipmi/
|
WorkingDirectory=/root/asrock-pwm-ipmi/
|
||||||
ExecStart=/root/asrock-pwm-ipmi/asrock-pwm-ipmi -a
|
ExecStart=/root/asrock-pwm-ipmi/asrock-pwm-ipmi -aq
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
12
pwm.py
12
pwm.py
@ -17,7 +17,8 @@ parser.add_argument('-i', '--info', action="store_true", default=False,
|
|||||||
help='Read fan information')
|
help='Read fan information')
|
||||||
parser.add_argument('-a', '--auto', action="store_true", default=False,
|
parser.add_argument('-a', '--auto', action="store_true", default=False,
|
||||||
help='Service to control fans based on temperature')
|
help='Service to control fans based on temperature')
|
||||||
|
parser.add_argument('-q', '--quiet', action="store_true", default=False,
|
||||||
|
help='Hide output')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
#print(args.info)
|
#print(args.info)
|
||||||
#print(args)
|
#print(args)
|
||||||
@ -32,6 +33,7 @@ def iterateFans(info):
|
|||||||
fan, speed = fanopt.split(":")
|
fan, speed = fanopt.split(":")
|
||||||
run_cmd.setSpeed(int(fan), int(speed))
|
run_cmd.setSpeed(int(fan), int(speed))
|
||||||
fanChanged = True
|
fanChanged = True
|
||||||
|
if args.quiet is False:
|
||||||
if int(speed) == 0:
|
if int(speed) == 0:
|
||||||
print("Set speed of FAN" + fan + " to Auto.")
|
print("Set speed of FAN" + fan + " to Auto.")
|
||||||
else:
|
else:
|
||||||
@ -44,11 +46,9 @@ while args.auto is True:
|
|||||||
if temp < MINTEMP:
|
if temp < MINTEMP:
|
||||||
for i in range(2, 7):
|
for i in range(2, 7):
|
||||||
speeds.append(str(i) + ":1")
|
speeds.append(str(i) + ":1")
|
||||||
#speeds = "2:1 3:1 4:1 5:1 6:1"
|
|
||||||
elif temp > MAXTEMP:
|
elif temp > MAXTEMP:
|
||||||
for i in range(2, 7):
|
for i in range(2, 7):
|
||||||
speeds.append(str(i) + ":100")
|
speeds.append(str(i) + ":100")
|
||||||
#speeds = "2:100 3:100 4:100 5:100 6:100"
|
|
||||||
else:
|
else:
|
||||||
base = temp - MINTEMP
|
base = temp - MINTEMP
|
||||||
max = MAXTEMP - MINTEMP
|
max = MAXTEMP - MINTEMP
|
||||||
@ -57,13 +57,11 @@ while args.auto is True:
|
|||||||
for i in range(2, 7):
|
for i in range(2, 7):
|
||||||
speeds.append(str(i) + ":" + str(speed))
|
speeds.append(str(i) + ":" + str(speed))
|
||||||
iterateFans(speeds)
|
iterateFans(speeds)
|
||||||
#print(speeds)
|
|
||||||
#time.sleep(1)
|
|
||||||
|
|
||||||
if args.info is False and args.fanplusspeed == []:
|
if args.info is False and len(args.fanplusspeed) == 0:
|
||||||
print("Nothing to do! See --help for usage.")
|
print("Nothing to do! See --help for usage.")
|
||||||
quit
|
quit
|
||||||
if args.fanplusspeed != []:
|
if len(args.fanplusspeed) != 0:
|
||||||
iterateFans(args.fanplusspeed)
|
iterateFans(args.fanplusspeed)
|
||||||
if args.info is True:
|
if args.info is True:
|
||||||
if fanChanged is True:
|
if fanChanged is True:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user