Answer the question
In order to leave comments, you need to log in
How to run a python script as a service on linux?
The simplest script
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
# тут происходит очень тяжёлая штука, которая занимает много времени. она нужна далее для обработки введенного текста и вывода результата. именно поэтому хочу чтобы скрипт работал как сервис и постоянно висел в памяти.
if len(sys.argv) == 2:
text = str(sys.argv[1]);
text = "You enter:" + text;
print(text)
Answer the question
In order to leave comments, you need to log in
The demon is not needed here at all, this is not what it is needed for.
Make the script executable
Create a symlink or to any directory from the PATH variable
Use as describedtest_demon hello
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question