no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Previous revision
Next revision
fuss:systemd [2021/01/22 23:20] – [Starting Programs on Virtual Terminals] office
Line 1: Line 1:
 +====== Making Changes to Daemon Files ======
  
 +Whenever a daemon file is changed in ''/etc/systemd/system/'', the daemon files must be reloaded with:
 +<code bash>
 +systemctl daemon-reload
 +</code>
 +
 +====== Starting Programs on Virtual Terminals ======
 +
 +Most *nix derivates start a login program such as ''getty'' on multiple virtual terminals for the user to log-in when the system boots. On pre-systemd systems, ''/etc/inittab'' was used to spawn (and re-spawn) ''getty'' on the virtual terminals, which could also be used to run console programs such as ''htop'' instead of the login terminal.
 +
 +The procedure with systemd is a little different and involves shutting down the tty services and creating a service file. The first thing to do is run:
 +<code bash>
 +systemctl
 +</code>
 +
 +and search (using forward-slash ''/'' and typing in text to search) for ''getty''. On a Debian system, one would find:
 +<code>
 +  getty@tty1.service                                                          loaded active running   Getty on tty2       
 +  getty@tty2.service                                                          loaded active running   Getty on tty2            
 +  getty@tty6.service                                                          loaded active running   Getty on tty6       
 +</code>
 +
 +which means that ''getty'' will be spawned on ''tty1'', ''tty2'' and ''tty6''. Whilst ''tty6'' has a special meaning and is a fallback console to always provide the means for an operator to log-in, ''tty1'' and ''tty2'' could be used to spawn a different program such as ''htop''.
 +
 +In order for ''getty'' and ''htop'' to not race each other, the first step is to stop and disable the ''getty@tty1.service'' service:
 +<code bash>
 +systemctl stop getty@tty1.service
 +systemctl disable getty@tty1.service
 +</code>
 +
 +Next, add the following contents to a file placed at ''/etc/systemd/system/htop.service'':
 +<code>
 +[Unit]
 +Description=htop on tty1
 +
 +[Service]
 +Type=simple
 +ExecStart=/usr/bin/htop
 +StandardInput=tty
 +StandardOutput=tty
 +TTYPath=/dev/tty1
 +Restart=always
 +RestartSec=2
 +
 +[Install]
 +WantedBy=getty.target
 +</code>
 +where:
 +  * ''/dev/tty1'' is the virtual terminal to start ''htop'' on.
 +
 +You can now enable and start the service via:
 +<code bash>
 +systemctl enable htop.service
 +systemctl start htop.service
 +</code>
 +
 +and ''htop'' should appear on the first virtual terminal.
 +
 +====== Set Runlevel ======
 +
 +The SystemD version of ''init 3'':
 +<code bash>
 +systemctl isolate multi-user.target
 +</code>
 +
 +and the ''init 4'' version:
 +<code bash>
 +systemctl isolate graphical.target
 +</code>
 +
 + 

fuss/systemd.txt · Last modified: 2023/12/10 03:16 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.