Options for running a script on a server for python

Separate command run with cli flask python.

This material is from a series of articles on website development in python: from local development to deployment on a remote server.

Options for running a Skip on Flask

Suppose we have code like this that updates something:

# Flask CLI
@app.clicommand()
def update():
from app.updatesupdates import start_updating
start_updating()

To run it on the command line, enter:

This command will run the script and monitor this process on the command line:

Will launch in “quiet” mode:

When running the script, will show it PIDand also frees up the command line to enter the following command:

flask update > /dev/null &

Shows:

The number above is the process number. It is convenient to know it if you later need to complete this process manually.

Options for stopping a Flask script

How to find a running python script on the system:

How to stop the script

Will stop all scripts with the name script_name_or_file_name:

pkill -nine -f script_name_or_file_name

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *