initial commit
This commit is contained in:
9
system/systemd/basic commands
Normal file
9
system/systemd/basic commands
Normal file
@@ -0,0 +1,9 @@
|
||||
> systemctl list-units
|
||||
|
||||
> sudo systemctl status mpd
|
||||
|
||||
> sudo systemctl daemon-reload
|
||||
|
||||
> sudo systemctl taskd.service start
|
||||
|
||||
> sudo systemctl status taskd.service
|
8
system/systemd/journal.md
Normal file
8
system/systemd/journal.md
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
Find errors since November
|
||||
|
||||
> journalctl --since=2018-11-01 --grep="EXT4-fs error"
|
||||
|
||||
Limit size to 2G.
|
||||
|
||||
> journalctl --vacuum-size=2G
|
34
system/systemd/making services.md
Normal file
34
system/systemd/making services.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Basics
|
||||
|
||||
A service can consist of two files - the .sh script to run, and the .service file which describes its run conditions.
|
||||
|
||||
The .service file goes in /etc/systemd/system. The scripts themselves might be best placed in $HOME/.local/bin.
|
||||
|
||||
# Example - tracker.service
|
||||
|
||||
```
|
||||
[Unit]
|
||||
Description=Tracker
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/path/to/script
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
||||
```
|
||||
|
||||
After making the new service, systemd requires reloading:
|
||||
|
||||
> sudo systemctl daemon-reload
|
||||
|
||||
# Types
|
||||
|
||||
* simple - the service cannot be called on by others. It runs on repeat.
|
||||
|
||||
* oneshot - the service executes once, then stops.
|
||||
|
||||
|
||||
|
23
system/systemd/test.service
Normal file
23
system/systemd/test.service
Normal file
@@ -0,0 +1,23 @@
|
||||
[Unit]
|
||||
|
||||
Description=Test
|
||||
|
||||
[Service]
|
||||
|
||||
ExecStart=/home/ghost/.local/bin/test
|
||||
|
||||
Restart=always
|
||||
|
||||
Type=simple
|
||||
|
||||
User=ghost
|
||||
|
||||
Group=ghost
|
||||
|
||||
[Install]
|
||||
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Alias=test.service
|
||||
|
||||
|
23
system/systemd/users.md
Normal file
23
system/systemd/users.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Automatic Login
|
||||
|
||||
> cp /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty1@.service
|
||||
|
||||
Modify the lines to look like these:
|
||||
|
||||
`ExecStart=-/sbin/agetty --autologin <username> --noclear %I 38400 linux`
|
||||
|
||||
`Type=oneshot`
|
||||
|
||||
`Restart=no`
|
||||
|
||||
In the `[Install]` section:
|
||||
|
||||
`Alias=getty.target.wants/getty@tty1.service`
|
||||
|
||||
Then enable the service:
|
||||
|
||||
> ln -sf /etc/systemd/system/getty1@.service /etc/systemd/system/getty.target.wants/getty@tty9.service
|
||||
|
||||
> systemctl start getty@tty9.service
|
||||
|
||||
|
Reference in New Issue
Block a user