I'm running a python script on a virtual machine (that I need VPN to access). This script usually takes 4 hours to complete.
If my desktop goes to sleep because of inactivity will it stop my script from running?
If so, how could I prevent that?
I'm running a python script on a virtual machine (that I need VPN to access). This script usually takes 4 hours to complete.
If my desktop goes to sleep because of inactivity will it stop my script from running?
If so, how could I prevent that?
It will probably terminate since VPN secured connections tend to go to sleep when the computer goes to sleep as well.
I would just go in your computer setting, in Power and Sleep and choose never for all the timeout dropdowns.
An other possibility if the virtual machine is runing Linux is to use the screen functionality of the terminal:
Screen or GNU Screen is a terminal multiplexer. In other words, it means that you can start a screen session and then open any number of windows (virtual terminals) inside that session. Processes running in Screen will continue to run when their window is not visible even if you get disconnected.
Have a look at this. Screens are very usefull when you have ssh connections taht you can't keep open for a long time.
Adjusting power settings works but it is not good for your laptop and battery. You must use a terminal multiplexer. These allow you to connect to your sessions even after you are disconnected to your VPN. And programs that you started in these session keep running even when you are disconnected. Basically, everything stays as it is in your sessions.
Note that you lose them when you turn your computer off. Tmux is way better than screen, I highly suggest you to install and use it. It is an industry standard.
Have a look at here for the basics: https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/