linux - Systemd没有激活服务?
问题描述
我需要在 systemd 上运行服务,因为它没有激活?由于我遵循文档的建议,为什么会发生这种情况,以下是代码:
服务代码:
# Contents of /etc/systemd/system/quark.service
[Unit]
Description=Quark
After=network.target
[Service]
Type=simple
User=cto
ExecStart=/usr/local/bin/python3.9 /var/net/
Restart=always
[Install]
WantedBy=multi-user.target
状态码:
● quark.service - Quark
Loaded: loaded (/etc/systemd/system/quark.service; enabled; vendor preset: en
Active: failed (Result: exit-code) since Mon 2021-06-21 15:20:34 UTC; 8s ago
Process: 1467 ExecStart=/usr/local/bin/python3.9 /var/net/ (code=exited, statu
Main PID: 1467 (code=exited, status=1/FAILURE)
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Main process exited, code=e
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Failed with result 'exit-co
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Service RestartSec=100ms ex
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Scheduled restart job, rest
Jun 21 15:20:34 webstrucs systemd[1]: Stopped Quark.
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Start request repeated too
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Failed with result 'exit-co
Jun 21 15:20:34 webstrucs systemd[1]: Failed to start Quark.
解决方案
ExecStart
应该是要执行的命令:
ExecStart=
Commands with their arguments that are executed when this service is started.
本节:
ExecStart=/usr/local/bin/python3.9 /var/net/
应该:
ExecStart=/usr/local/bin/python3.9 path_to_python_script.py
推荐阅读
- r - 循环清洗数据集 (R)
- matplotlib - 为什么 Matplotlib.pyplot 在 Visual Studio Code 中不起作用?
- c++ - 有什么方法可以使变量类型与它所在的类的类型相同,并且是静态的和 const 而不是指针?
- c++ - 部分排序不适用于向量
- ruby-on-rails - 在保存模型之前 Sidekiq 邮件程序作业访问数据库
- node.js - 一台服务器上的 React 和 GraphQL
- jupyter-notebook - Kubeflow:笔记本服务器卡在加载中
- python-3.x - Python:查找排序和旋转数组中的最小元素
- c# - 如何在字符串中找到单词的所有起始索引?
- javascript - 禁用街景,全屏谷歌地图反应