I'm using a python script named vpngate.py.
This script takes as a parameter a country so when i launch my program i do : python vpngate.py korea (for instance). It allows me to change my IP address, looking to the specified country an available IP address.
When i will launch my program, i will have my IP changed (the program is running).
When i will stop my program, i will get my old IP back. And it's only after stopping my program, that i want to re-launch it in order to have a new IP etc..
I read that from package sys, i can import exit, to stop my program. But my question is : how to programatically plan to launch my program every 2minutes for instance. I need to precise that i'm on windows (so the CRON solution doesn't work), and that's really import that the script is ran in background, because i have other script running in parallel. I hope that i was clear enough. Thank you in advance.
Asked
Active
Viewed 243 times
-1
1 Answers
0
Have you tried putting the code performing the setting of IP in a function and calling it from a python script with time.sleep() to time execution.

quest
- 3,576
- 2
- 16
- 26
-
The problem is that when i launch my program, i can't do another one. If i call my function, i can't do my other script. – Mohamed May 22 '17 at 13:59
-
i think multithreading is the answer. please have a look at this post if it helps https://stackoverflow.com/questions/2846653/how-to-use-threading-in-python – quest May 22 '17 at 17:37