小编bra*_*rad的帖子

python 脚本无法在 systemd 的屏幕中启动。没有错误

我写了一个 python 脚本,我想在屏幕内启动

screen -d -m /usr/bin/python3 /home/kermit/active-climateMngr.py
Run Code Online (Sandbox Code Playgroud)

它在命令行上工作得很好,但是当我尝试在 systemd 作为服务启动它时,没有任何屏幕会话启动。

.服务配置:

[Unit]
Description=Test Service
After=multi-user.target
Conflicts=getty@tty1.service

[Service]
Type=simple
ExecStart=/usr/bin/screen -d -m /usr/bin/python3 /home/kermit/active-climateMngr.py
StandardInput=tty-force

[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)

系统:

kermit@minnow:~ $ sudo service active-climateMngr.py status
? active-climateMngr.py.service - Test Service
   Loaded: loaded (/lib/systemd/system/active-climateMngr.py.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Sat 2021-02-20 08:58:46 CST; 4min 7s ago
  Process: 14373 ExecStart=/usr/bin/screen -d -m /usr/bin/python3 /home/kermit/active-climateMngr.py (code=exited, status=0/SUCCESS)
 Main PID: 14373 (code=exited, status=0/SUCCESS)

Feb 20 08:58:46 minnow.coinz.com systemd[1]: Started Test Service.
Feb …
Run Code Online (Sandbox Code Playgroud)

python systemd services python3

4
推荐指数
1
解决办法
241
查看次数

标签 统计

python ×1

python3 ×1

services ×1

systemd ×1