Differences

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

Link to this comparison view

Both sides previous revision Previous revision
fuss:systemd [2017/09/12 17:26]
office [Starting Programs on Virtual Terminals]
fuss:systemd [2017/09/12 17:32] (current)
office [Starting Programs on Virtual Terminals]
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.
 +
 +
 +
 + 

fuss/systemd.txt ยท Last modified: 2017/09/12 17:32 by office

Access website using Tor Access website using i2p


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