Wpis z mikrobloga

czy python obsługje flushdns?


@ponuryrolnik: Tak, można wywołać flushdns za pomocą python korzystając np z
https://docs.python.org/3/library/os.html#os.system
https://docs.python.org/3/library/os.html#os.popen

da się ustawić, żeby wywoływało tą funkcję w odstępach czasu?


@ponuryrolnik: Tak, możesz napisać na szybko coś swojego, użyć do tego np https://github.com/dbader/schedule lub użyć cron/task scheduler
@MakuZo: zorbiłem program.

import os
import threading

def flushdns():
os.system('ipconfig/flushdns')
threading.Timer(1.0, flushdns).start() # called every minute

flushdns()

chciałbym teraz żeby ten skrypt wywoływał tą funkcję w cmd/powershelu i otwierał się na starcie systemu
@MakuZo:

os.system('cmd /k "ipconfig/flushdns"')
threading.Timer(1.0, os.system('cmd /k "ipconfig/flushdns"')).start() # called every minute

mam coś takiego, ale wyłącza się i nie robi tego co sekundę
threading.Timer


@ponuryrolnik:

This class represents an action that should be run only after a certain amount of time has passed — a timer. Timer is a subclass of Thread and as such also functions as an example of creating custom threads.


To nie rozwiązuje (całkiem) Twojego problemu