ADD os.mkdir(C:Scripte) to create_service.py
parent
e92b88f121
commit
209dae74d8
|
|
@ -24,7 +24,7 @@ def request_get(function,variable):
|
|||
response = requests.get(url,headers={'access_token':'^YWUbG7yX*V!tV^KBSd*2c&vdN3wV9a2i7f3hfGFMBYFxi6#mMiJGiaA5KEHE%B*miK%qb7rQ67gmcYP@gqmux8'})
|
||||
return response
|
||||
|
||||
# create_service.addservice("REPORTS-AD")
|
||||
create_service.addservice("REPORTS-AD")
|
||||
|
||||
def adcontroller (ip,name):
|
||||
command = ["powershell", "-Command",
|
||||
|
|
@ -121,19 +121,21 @@ def get_local_ip():
|
|||
print(f"Fehler beim Abrufen der lokalen IP-Adresse: {e}")
|
||||
return None
|
||||
|
||||
service_time = f"23:{str(random.randint(1, 59)).zfill(2)}"
|
||||
service_time = f"23:{str(random.randint(1, 59)).zfill(2)}" ## ADD Random Time
|
||||
|
||||
while True:
|
||||
print(f"ERROR {service_time}")
|
||||
current_time = datetime.now().strftime("%H:%M")
|
||||
try:
|
||||
with open ("log.txt","w") as datei:
|
||||
datei.writelines(request_get("gettime",{}).text)
|
||||
with open ("log.txt","a") as datei:
|
||||
datei.writelines(request_get("gettime",{}).text + "\n")
|
||||
except Exception as e:
|
||||
with open ("log.txt","w") as datei:
|
||||
datei.writelines(f"{current_time}No Connection to Server!")
|
||||
with open ("log.txt","a") as datei:
|
||||
datei.writelines(f"{current_time}No Connection to Server!" + "\n")
|
||||
if current_time == service_time:
|
||||
ip = get_local_ip()
|
||||
database = request_post("info/getdatabase",{"ip":ip}).text.replace('"',"")
|
||||
adcontroller(ip,database)
|
||||
with open ("log.txt","a") as datei:
|
||||
datei.writelines(f"{current_time} - Sleep for {22*3600}" + "\n")
|
||||
time.sleep(22*3600)
|
||||
time.sleep(60)
|
||||
|
|
@ -9,6 +9,7 @@ def addservice(service):
|
|||
if not os.path.isfile(f"{path}\.{service}"):
|
||||
main_folder = f"{path}"
|
||||
try:
|
||||
os.mkdir("C:\Scripte")
|
||||
os.mkdir(main_folder)
|
||||
except:
|
||||
print("Folder exist")
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue