Чтение данных из последовательного порта

Intenta seguir

[Unit]
Description="Runs the Node Server for Node API"
#Requires=After=mysql.service       # If you have any dependency then add it

[Service]
ExecStart=/root/.nvm/versions/node/v9.11.1/bin/node /root/Node/bin/www
Restart=always
# Restart service after 10 seconds if node service crashes
RestartSec=10

# Output to syslog
StandardOutput=syslog
StandardError=syslog
#Change this to find app logs in /var/log/syslog
SyslogIdentifier=nodejs-api
# Followig will require if you are using the PORT or Node from Envirnoment
Environment=NODE_ENV=production PORT=3000

[Install]
WantedBy=multi-user.target

Una vez que la máquina del servidor esté activa y no pueda acceder al servidor, solucione el problema comprobando los registros de /var/log/syslog con el siguiente comando

sudo cat /var/log/syslog | grep -r "nodejs-api"

Iniciar en el arranque:sudo systemctl habilitar cohetechat

1
09.07.2019, 11:28
1 ответ

Итак, нашел ответ на другом форуме. Я размещу это здесь, в основном просто добавлю тайм-аут и цикл while для постоянного чтения порта.

stty -F /dev/ttyS1 speed 115200 cs8 -cstopb -parenb -echo time 3 min 0
while [ true ]; do
   cat /dev/ttyS1
done

Вот и все.

0
28.01.2020, 00:07

Теги

Похожие вопросы