Skip to content

This is an example of how to turn your argumented callable python script into a process on UNIX

Notifications You must be signed in to change notification settings

navarmn/daemon_process_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Running python scrit as a background process on UNIX

This is an example about how to turn your .py files into a process with a PID number UNIX. This is suitable when you would like to run a task for an indefinite period of time. This also allows you to reserve you shell section, and this can be particulary good when using containers.

All of that is possible by running what is called a daemon process. For more information google it

How to use

Install requirements.txt using pip install -r requirements.txt

Run the following commands in shell:

python app_daemon.py --t 1 --path /home/

This script is merely an example and it just creates ordered dumb files in a given path each t seconds for as along as the process run.

This is an extension of this example, providing an integration with argparse module.

How to stop the process

Among all process ruuning grep the one by its .py name and kill it as,

ps ax | grep app_daemon

GET THE PID NUMBER and,

kill #######

About

This is an example of how to turn your argumented callable python script into a process on UNIX

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages