[How-To] Autostart programs on consoles

Difficulty: ★☆☆☆☆


Thanks to the feedback and idea from @papajoke in Autostart programs on consoles, i solved it by creating only the following two files:
(including the missing sub-dirs ofcourse),

/etc/systemd/system/getty@tty11.service.d/00-console-app.conf
# /etc/systemd/system/getty@tty11.service.d/00-console-app.conf
[Unit]
Description=Live Process-monitor on %I

[Service]
Environment='UnitOptions='
ExecStart=
ExecStart=-/usr/bin/htop $UnitOptions
/etc/systemd/system/getty@tty12.service.d/00-console-app.conf
# /etc/systemd/system/getty@tty12.service.d/00-console-app.conf
[Unit]
Description=Live Journal-logs on %I

[Service]
#Environment='SYSTEMD_PAGERSECURE=1'
Environment='UnitOptions=--all --follow --catalog'
ExecStart=
ExecStart=-/usr/bin/journalctl $UnitOptions

Followed by:

  1. systemctl daemon-reload
  2. systemctl enable --now getty@tty1{1,2}

Now i have access to these at boot-up and can switch to them using CTRL+ALT+F11 and CTRL+ALT+F12 respectively, and return to my GUI using CTRL+ALT+F1 :blush:

To have them run on another console all that is needed is to rename the sub-dir they are placed in and enable/start them.
(ofcourse doing disable --now before the renames)

And here’s another one i just created…
This one runs nyx on console 10 CTRL+ALT+F10 :vulcan_salute:

/etc/systemd/system/getty@tty10.service.d/00-console-app.conf
# /etc/systemd/system/getty@tty10.service.d/00-console-app.conf
[Unit]
Description=Live Tor-monitor on %I
Requires=tor.service
After=tor.service

[Service]
User=tor
Group=tor
Environment='UnitOptions='
ExecStart=
ExecStart=-/usr/bin/nyx $UnitOptions