systemd 服务在 Ubuntu 上运行,但无法在 Raspbian (Debian) 上运行

systemd 服务在 Ubuntu 上运行,但无法在 Raspbian (Debian) 上运行

成功创建服务订阅MQTT主题后,开机时,如图这里,

当我在我的树莓派上尝试并进行必要的修改时,服务无法启动。

.shraspbian 中的文件(因为它gnome-terminal与 ubuntu 中不同):

#! /bin/bash
topic1="myHome/Messages"
topic2="myHome/log"
topic3="myHome/debug"

user="guy"
password="kupelu9e"
broker="192.168.2.100"


lxterminal --display=:0 --title=$topic1 --command="mosquitto_sub -h $broker -t $topic1 -u $user -P $password" &
lxterminal --display=:0 --title=$topic2 --command="mosquitto_sub -h $broker -t $topic2 -u $user -P $password" &
lxterminal --display=:0 --title=$topic3 --command="mosquitto_sub -h $broker -t $topic3 -u $user -P $password" &

lxterminal --display=:0 --command="mosquitto_pub -h $broker -t "myHome/All" -u $user -P $password -m "status""

原因可能是什么?

Edit_1 输出

systemctl --user status mqtt_sub.service输出:

 mqtt_sub.service - MQTT subscribtion on terminal
     Loaded: loaded (/home/guy/.config/systemd/user/mqtt_sub.service; enabled; vendor preset: enabled)
     Active: inactive (dead)

`journalctl --user -xeu mqtt_sub.service' 输出:

guy@raspberry:~ $ journalctl  --user -xeu mqtt_sub.service
 Support: https://www.debian.org/support
 
 The unit UNIT has successfully entered the 'dead' state.
-- Boot a7010da460194e7394fa641e0165314c --
Apr 13 08:01:28 raspberry systemd[947]: Starting MQTT subscribtion on terminal...
 Subject: A start job for unit UNIT has begun execution
 Defined-By: systemd
 Support: https://www.debian.org/support
 
 A start job for unit UNIT has begun execution.
 
 The job identifier is 143.
Apr 13 08:01:28 raspberry systemd[947]: Started MQTT subscribtion on terminal.
 Subject: A start job for unit UNIT has finished successfully
 Defined-By: systemd
 Support: https://www.debian.org/support
 
 A start job for unit UNIT has finished successfully.

相关内容