adding personal scripts

This commit is contained in:
2025-05-20 09:15:41 -04:00
parent fd41d1f0aa
commit 428084e4ee
9 changed files with 272 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
ipmitool -I lanplus -H 192.168.128.223 -U root -P Optimus0329 -y 0000000000000000000000000000000000000000 power off
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
ipmitool -I lanplus -H 192.168.128.223 -U root -P Optimus0329 -y 0000000000000000000000000000000000000000 power on
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/python3
import os
import sys
import subprocess
from subprocess import check_output, run
import time
from time import sleep
import datetime
from datetime import datetime
def get_time():
ts1 = str(datetime.now()).split('.')[0]
return ts1
def call_powerup(vmid):
run(['/usr/sbin/qm','start',vmid])
def monitor_status(vmid):
vmstatus = 'stopped'
while vmstatus == 'stopped':
sleep(5)
vmstatus = check_output(['/usr/sbin/qm','status',vmid])
vmstatus = vmstatus.decode().split(': ')[1].rstrip()
return 'Done'
def main():
timestamp = get_time()
print(f'Start time: {timestamp}')
vms = ['105']
for vm in vms:
try:
print(f'starting up {vm}')
call_powerup(vm)
vresult = monitor_status(vm)
print(f'{vresult}')
except Exception as e:
print(f'{vm} currently not running')
timestamp = get_time()
print(f'End time: {timestamp}')
if __name__ == '__main__':
main()