Second SSH necessary? How to keep the droplet active without an active session?
Hi there, I’m new to this, but I have small basic experience with my Raspberry Pi and Debian.
What I want to reach:
I want a Debian system, where I can run a Python 3.4 script, which includes an endless loop (so in the script is a “while True” condition). It makes some API calls to several websites, calculates some numbers and save the result in a .txt file and also prints some of the results. This should be done 24hours a day nonestop. Of course it should be only accessed by me, regardless where I am.
What I already did:
- I made a droplet with Debian 8 and followed this instruction to enable the SSH authentication: https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-putty-on-digitalocean-droplets-windows-users So now I’m able to access my droplet via WINSCP and Putty, via SSH.
- I also installed all necessary packages from python to run my script.
- Now I thought it would be a good idea to follow this guide: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-debian-8
I did step 1-3.
First Question about second SSH:
But now in Step Four, there is something written about SSH again. Why? I already enabled SSH to access my droplet. Why another SSH ?
My thought is: “no one except me should be able to access my droplet, so why a second security measure? The first should be save enough?” Or is there another reason for this second SSH?
If access my droplet via Putty and start the script, it will run. But if I close Putty, I think also my script is shut down. But I want the script to run 24h a day. At my Raspberry Pi I have a desktop environment with Remote access from my PC (xrdp). I just start the terminal and start the script in it. When closing the remote access, the script is not shut down. Now I can start the remote connection from time to time, to check the prints from my script, if it is still running without problems.
This is what I also want for my droplet now. The Desktop is not necessary I think (only 512 ram), but I want a way, to see the prints from the script and to check from time to time, if everything is still running.
Is there anything else I should do? Maybe a VPN (what is a VPN?) ?
Thank You :)
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.