gpt4 book ai didi

linux - 如何在centos 7上重新加载pythonic服务?

转载 作者:行者123 更新时间:2023-12-03 09:52:46 24 4
gpt4 key购买 nike

我有一个python应用程序,它作为centos 7上的一项服务。
我在/usr/lib/systemd/system中用我的项目名称创建了一个文件。并在上面写这些:

[Unit]
Description=My Script Service
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python3.6 /usr/src/python-project/sampleService-services/serverprotocol.py
[Install]
WantedBy=multi-user.target

之后:
$ sudo systemctl daemon-reload
$ sudo systemctl enable sampleService.service
$ sudo reboot

我可以使用以下命令启动,重新启动和停止该服务:
$ systemctl start sampleService.service
$ systemctl restart sampleService
$ systemctl stop sampleService

但是,当我尝试使用以下命令重新加载它时:
$ systemctl reload sampleService

要么
$ service sampleService reload

我收到此错误:

Failed to reload sampleService.service: Job type reload is not applicable for unit basiscore.service. See system logs and 'systemctl status sampleService.service' for details.



有什么命令可以重新加载此pythonic服务吗?

如何在不重新启动服务的情况下重新加载我的服务?

最佳答案

ExecStart=行下,尝试添加

Restart=on-failure
RestartSec=10s

关于linux - 如何在centos 7上重新加载pythonic服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51330007/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com