How to keep the programs on the cloud server running all the time?

I wrote a Mini Program to get the score, send the request to the server, and then the server returns the corresponding information, but every time I run the Mini Program program, I need the computer on, and then log in to the server remotely and run main.py, manually to keep the program on the server running

so I want to know how to make the programs on the cloud server run automatically all the time, instead of having to turn on my computer and run main.py manually every time I need to request a message.

Mar.19,2021

according to your file is a Python program

nohup python main.py &

if it is a Linux system, use nohup.


I have written server programs in node, which should be not much different from Python. Try to see if the parameters are wrong.


write a self-starting service and execute the script automatically.


write a script to start running automatically, you can


use screen


of course, the monitoring script uses Supervisor . Here's how to use it:

< H2 > Supervisor configuration < / H2 >

install Supervisor

Supervisor is a process monitor for the Linux operating system that automatically restarts a process if it fails. To install Supervisor, on Ubuntu, you can use the following command:

sudo apt-get install supervisor

configure Supervisor

Supervisor configuration files are usually stored in the / etc/supervisor/conf.d directory. In this directory, you can create any number of configuration files that will directory how supervisor monitors your process. For example, let's create a worker.conf file, start and monitor the work process:

[program:worker]
process_name=%(program_name)s_%(process_num)02d
command=python /XXX/main.py
autostart=true
autorestart=true
user=forge
numprocs=2
redirect_stderr=true
stdout_logfile=/home/user/worker.log
stopwaitsecs=3600

in this example, the numprocs instruction instructs the monitor to run two work processes and monitor all processes, automatically restarting them if they fail.

Note: please replace the file directory. You should make sure that the value of stopwaitsecs is greater than the number of seconds consumed by the longest running task. Otherwise, Supervisor may terminate the task before it completes.

start Supervisor

after creating the configuration file, you can update the Supervisor configuration and start the process using the following command:

sudo supervisorctl reread

sudo supervisorctl update

sudo supervisorctl start worker:*

for more information about Supervisor, please refer to Supervisor documentation

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b4e3-2c277.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b4e3-2c277.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?