amol rane
amol rane

Reputation: 335

custom systemd service is not working in ubuntu 18.04

I have chatbot.service in lib/systemd/system when I start this service it gives me no error but it is not running my python file. when I check status of the service it shows service is enabled but Inactive.I am sending code from chatbot.service file

[Unit]
Description=chatbot Service
After=multi-user.target
[email protected]

[Service]
Type=simple
ExecStart=/usr/bin/python2 /home/administrator/Downloads/chatbot.py
StandardInput=tty-force``

[Install] WantedBy=multi-user.target

Upvotes: 3

Views: 1972

Answers (1)

amol rane
amol rane

Reputation: 335

#Create Service File

sudo vi /lib/systemd/system/dummy.service


************************************************
[Unit]
Description=Dummy Service
After=multi-user.target
[email protected]

[Service]
Type=simple
ExecStart=<your_python_path> <python_file_path>
StandardInput=tty-force

[Install]
WantedBy=multi-user.target

*****************************************
#Enable Newly Added Service

sudo systemctl daemon-reload


sudo systemctl enable dummy.service
sudo systemctl start dummy.service


#Status of new Service

sudo systemctl status dummy.service

Upvotes: 2

Related Questions