![systemctl 运行正常,但状态显示正在激活](https://linux22.com/image/205206/systemctl%20%E8%BF%90%E8%A1%8C%E6%AD%A3%E5%B8%B8%EF%BC%8C%E4%BD%86%E7%8A%B6%E6%80%81%E6%98%BE%E7%A4%BA%E6%AD%A3%E5%9C%A8%E6%BF%80%E6%B4%BB.png)
我有一个简单的systemd.service
方法可以从 LTE 模块启动 qmi 连接。它工作正常,并且在我启动服务时建立了连接。我的问题是,状态并不通知服务已经activated
,但永久已经activating
。
这是状态:
● qmi_connect.service - QMI Auto Connection
Loaded: loaded (/etc/systemd/system/qmi_connect.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) since Wed 2022-04-27 11:45:28 BST; 4s ago
Process: 8030 ExecStart=/bin/bash /home/pi/Ubiquo/LTE/qmi/qmi_connect.sh (code=exited, status=0/SUCCESS)
Main PID: 8030 (code=exited, status=0/SUCCESS)
CPU: 491ms
服务:
[Unit]
Description=QMI Auto Connection
After=network.target
[Service]
User=root
ExecStart=/bin/bash /home/pi/Ubiquo/LTE/qmi/qmi_connect.sh
WorkingDirectory=/home/pi/Ubiquo/LTE/qmi
StandardOutput=inherit
StandardError=inherit
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
以及启动 qmi 连接的 bash 脚本:
#!/bin/bash
APN="net2.vodafone.pt"
ip link set dev wwan0 down
echo Y > /sys/class/net/wwan0/qmi/raw_ip
ip link set dev wwan0 up
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --wds-start-network="ip-type=4,apn=$APN" --client-no-release-cid
udhcpc -q -f -n -i wwan0