MQTT 주제를 구독하는 서비스를 성공적으로 생성한 후 시작하면 그림과 같이여기,
Raspberry Pi에서 시도하고 필요한 수정을 하면 서비스가 시작되지 않습니다.
.sh
Raspbian의 파일(우분투와 다르기 때문에 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.