I’m want to run a python script and I need it working 24/7. I have a Raspberry Pi 4 (it’s running the last version of raspbian) and I connect it using VNC but after a few times when I try to connect to my Raspberry Pi to see what’s going on is like the VNC reconnects me and kills the old session (that’s what I think) or maybe just disappear.

  • I already changed idletimeout to 0 and also try to use teamviever but is the same.
  • I think if I connect the Raspberry Pi to HDMI to any screen and then connect via VNC the problem is solved, but I want to know if exists another solution.
  • If you need to run continuously why are you using VNC?
    – Milliways
    Jan 29, 2022 at 21:35
  • I m expressed wrong, I run the python script but then one time per hour i need to check if it s running ok, so i need to keep the session Jan 30, 2022 at 2:09
  • Use an ssh connection and run the script e.g. in a screen. Then you can log off without killing the script and later reconnect via ssh and resume the screen.
    – Robert
    Jan 30, 2022 at 21:04

1 Answer 1


If you want to run a python script (or indeed any script) continuously start it running in the background or use tmux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.