systemdサービスはUbuntuで実行されますが、Raspbian(Debian)では実行されません。

systemdサービスはUbuntuで実行されますが、Raspbian(Debian)では実行されません。

MQTTトピックを購読するサービスを正常に作成した後、起動すると、ここ

Raspberry Piで試して必要な修正を加えると、サービスは開始されません。

.shRaspbianのファイル(Ubuntuとは異なるためgnome-terminal):

#! /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.

ベストアンサー1

おすすめ記事