Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to: Automatically start armbianmonitor on serial terminal

Featured Replies

Hi,

To enable the armbianmonitor to show information on the running system on the serial console, I used to have a custom startup script, called from /etc/rc.local. After some time, I thought it was more neat to have this automatically started (and stopped) for login sessions that are started on serial consoles/terminals.

 

This lead (led?) me to the following systemd unit file:

[Unit]
Description=armbianmonitor on ttyS2
Requires=serial-getty@ttyS2.service
After=serial-getty@ttyS2.service 
After=getty.target
BindsTo=serial-getty@ttyS2.service 

[Service]
Type=idle
ExecStartPre=-/bin/sleep 10
ExecStart=/usr/bin/armbianmonitor -m
TTYPath=/dev/ttyS2
StandardInput=null
StandardOutput=tty
StandardError=syslog
KillSignal=SIGKILL
SendSIGHUP=yes

[Install]
WantedBy=serial-getty@ttyS2.service

 

File goes into /usr/lib/systemd/system/armbianmonitor@ttyS2.service. To 'activate' it, perform the following after creating the file at the specified location:

sudo systemctl daemon-reload
sudo systemctl enable armbianmonitor@ttyS2
sudo systemctl stop armbianmonitor@ttyS2
sudo systemctl start armbianmonitor@ttyS2

 

This is currently working for me on OrangePi Zero, NanoPi R2S, Helios4 (@ttyS0) and Helios64.

 

If you do not have serial-getty services started on ttyS2 - like in the example unit file - you will need to modify the 'ttyS2' with the serial console matching your situation.

 

Note that the new armbianmonitor@ttyX service will auto-start when seial-getty@ttyX is started and it will also stop when serial-getty@ttyX is stopped. This is to prevent orphaned armbianmonitors. Fun thing to try is to stop and start serial-getty@ttyX and also see the armbianmonitor service for that tty stop/start in tandem.

 

Hope this helps anyone out there, it's always nice to have serial output available in case things happen (and they always happen unexpectedly).

 

Groetjes,

 

p.s. See below spoiler for auto-adding these unit files based on your currently enabled serial-getty services.

Spoiler

#!/bin/bash

systemctl list-units --type=service --state=active,inactive --full --no-pager --no-legend --plain "serial-getty@*" |
    while read _UNIT _DONTCARE
    do
        _DEVICE="${_UNIT%.service}"
        _DEVICE="${_DEVICE##*@}"
        _FILE="/lib/systemd/system/armbianmonitor@${_DEVICE:?}.service"
        
        {
            cat << EOF
[Unit]
Description=armbianmonitor on ${_DEVICE:?}
Requires=${_UNIT:?}
After=${_UNIT:?} 
After=getty.target
BindsTo=${_UNIT:?} 

[Service]
Type=idle
ExecStartPre=-/bin/sleep 10
ExecStart=/usr/bin/armbianmonitor -m
TTYPath=/dev/${_DEVICE:?}
StandardInput=null
StandardOutput=tty
StandardError=syslog
KillSignal=SIGKILL
SendSIGHUP=yes

[Install]
WantedBy=${_UNIT:?}
EOF
        } | sudo tee "${_FILE:?}" > /dev/null

        sudo chown root:root "${_FILE:?}"
        sudo chmod 0644 "${_FILE:?}"
        sudo systemctl daemon-reload
    done
    
# EOF

 

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.