N
N
Nikita M.2021-03-30 21:09:19
linux
Nikita M., 2021-03-30 21:09:19

How to run the script on VPS correctly?

Good evening, there is a vps server with ubuntu 20.04 on it. Two python scripts are running on the server 24/7. But they only work when I'm in an ssh session with a vps (ssh client - mobachterm). As soon as I exit the server the scripts stop working.
That is, I go to the server, run the scripts, and until I left the server, the scripts work.
Notes:

  • I put scripts in bg%
  • scripts log about their start / end, and I know exactly at what moment they take off


UPD: a little about the script. Makes a bunch of requests via curl and requests, parses csv, logs, saves data to the database, sends letters to mail and telegrams. Maybe it has some meaning.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2021-03-30
@unknowndeal

the easiest way to run with nohup (nohup /there/is/path/to/your/script &)
the correct way is to set up services to run and control your scripts. https://habr.com/ru/company/southbridge/blog/255845/

R
Ruslan Fedoseev, 2021-03-31
@martin74ua

man screen
man tmux

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question