• Uncategorized

About python : Use-python-with-threading-as-service-in-Linux

Question Detail

I create a python code like below:

base_func() #start this function once
t1 = threading.Thread(target=loop_func_1)
t2 = threading.Thread(target=loop_func_2)
t1.start()
t2.start()
t1.join()
t2.join()
#both threads (t1 and t2) having unlimited while inside them

loop_func_1 also include python multiprocessing

I try to create Linux service file like below:

[Unit]
Description = my code description
After = network.target
 
[Service]
Type = simple
WorkingDirectory = /home/script_location/
ExecStart = /usr/bin/python3 /home/scrip_file_location.py
Restart = on-failure

[Install]
WantedBy = multi-user.target

After I start the service there is no error and the service has been activated, but the script not working

I check status with the command below:

sudo systemctl status myservicename

Question Answer

No answer for now.

You may also like...

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.