Compare commits
5 Commits
5b90bf87fd
...
9dd0c2c8ba
Author | SHA1 | Date |
---|---|---|
Gilles Grandou | 9dd0c2c8ba | |
Gilles Grandou | 47e5868451 | |
Gilles Grandou | 4f16dd2ed1 | |
Gilles Grandou | 2894b6b476 | |
Gilles Grandou | fab20bdb7f |
17
run
17
run
|
@ -7,6 +7,8 @@ session="tic2mqtt"
|
|||
cmd=""
|
||||
quiet=""
|
||||
|
||||
cd $rundir
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
start) cmd=$1;;
|
||||
|
@ -57,9 +59,18 @@ case "$cmd" in
|
|||
;;
|
||||
log)
|
||||
if [ -n "$is_running" ]; then
|
||||
tmux capture -b $session -p -S - | head -15
|
||||
echo "[...]"
|
||||
tmux capture -b $session -p -E -
|
||||
tmp=$(mktemp)
|
||||
tmux capture -b $session -p -S - >$tmp
|
||||
if [ $(cat $tmp |wc -l) -gt 30 ]; then
|
||||
head -10 $tmp
|
||||
echo
|
||||
echo "[...]"
|
||||
echo
|
||||
tail -20 $tmp
|
||||
else
|
||||
cat $tmp
|
||||
fi
|
||||
rm -f $tmp
|
||||
else
|
||||
echo "no tic2mqtt running"
|
||||
fi
|
||||
|
|
|
@ -92,9 +92,12 @@ static void tic2mqtt_process_group(const char *tag, const char *data, time_t dat
|
|||
strncpy(ptag_desc->data, data, ptag_desc->len);
|
||||
|
||||
char topic[TOPIC_MAXLEN + 1];
|
||||
char stamp_str[32];
|
||||
|
||||
snprintf(topic, TOPIC_MAXLEN, "tic2mqtt/%s/%s", tic_name, tag);
|
||||
|
||||
log_info("%ld %s %s\n", stamp, topic, data);
|
||||
strftime(stamp_str, 32, "%Y-%m-%d %H:%M:%S", localtime(&stamp));
|
||||
log_info("%s %s %s\n", stamp_str, topic, data);
|
||||
|
||||
if (mosq_tic) {
|
||||
int res = mqtt_publish(mosq_tic, topic, NULL, data, TIC_QOS);
|
||||
|
|
Loading…
Reference in New Issue