added &> /dev/null at the end of the command to prevent spam in tty

This commit is contained in:
Willy 2023-10-24 02:24:44 -04:00
parent ea38d70886
commit e2a7b32961
1 changed files with 2 additions and 3 deletions

View File

@ -24,13 +24,12 @@ print("Started!")
# Script
while True:
output = subprocess.check_output('ipmitool sdr list | grep "Chassis Intru"', shell=True).decode()
output = subprocess.check_output('ipmitool sdr list &> /dev/null | grep "Chassis Intru" &> /dev/null', shell=True).decode()
for line in output.splitlines():
if 'Chassis Intru' in line:
status = line.split('|')[1].strip()
print(f"Current Status: {status}")
if status == '0x01':
print("TRIGGERED! Running Command...")
print(f"{status} CHASSIS INTRUSION DETECTED! Running Command...")
subprocess.run(command, shell=True)
time.sleep(rescan_delay)