我在lib / systemd / system中有chatbot.service,当我启动这个服务时,它没有给我任何错误,但它没有运行我的python文件。当我检查服务的状态时,它显示服务已启用但非活动。我正在从chatbot.service文件发送代码
bookSearch(query) {
if (query.length > 0)
BooksAPI.search(query)
.then(searchResults => {
if(query === this.state.query){
this.setState(currentState => (
{
results: this.updateExistingShelves(searchResults)
}))
}
);
}
[安装] WantedBy = multi-user.target
答案 0 :(得分:0)
#Create Service File
sudo vi /lib/systemd/system/dummy.service
************************************************
[Unit]
Description=Dummy Service
After=multi-user.target
Conflicts=getty@tty1.service
[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