This commit is contained in:
2026-04-27 01:30:33 +02:00
parent 9e29b8b096
commit 49e7930541
80 changed files with 924 additions and 703 deletions

View File

@@ -5,8 +5,8 @@ tags:
- ansible
- orchestration
requires:
- ssh
- pass
- networking/ssh.md
- data/pass.md
---
# Start Locally

View File

@@ -5,8 +5,8 @@ tags:
- ansible
- docker
requires:
- docker
- ansible
- virtualization/docker.md
- system/ansible.md
---
'Docker module', you say?

View File

@@ -2,7 +2,7 @@
title: awk
tags:
- system
- .csv
- csv
---
# Basics

View File

@@ -7,33 +7,46 @@ tags:
Check which groups you are in, and which are available:
```sh
cat /etc/group
groups
cat /etc/group | grep $USER
cat /etc/group
column -ts: /etc/group
grep $USER !$
```
Remove yourself from all groups, and add yourself back to only `wheel`, `audio`, and your own group:
Remove yourself from all groups, and add yourself back to only `mail`, `audio`, and your own group:
```sh
sudo usermod --groups wheel,audio,$USER
sudo usermod --groups mail,audio,$USER
```
Add yourself to the `docker` group:
Add yourself to the `docker` group, if there is one:
```sh
su root -c "usermod --append --groups docker $USER"
grep docker /etc/group
sudo usermod --append --groups docker $USER
```
Add yourself to the `network` group:
Add yourself to the `games` group:
```sh
sudo usermod -aG network $USER
sudo usermod -aG games $USER
```
You are now legally permitted to play [games](shell/games.md).
The changes have not taken effect, so log into your own account again with `su`:
```sh
groups
sudo su $USER
grep audio /etc/group
sudo usermod -aG audio $USER
groups
grep audio /etc/group
su $USER
groups
grep audio /etc/group
```

View File

@@ -1,13 +1,13 @@
---
title: Python Projects with Makefiles
tags:
- tutorial
- setup
- system
- makefiles
- graphviz
- python
requires:
- makefiles
- system/makefiles.md
---
If you have a python script which requires a packages - e.g. `graphviz` - you can automate the setup with a `Makefile`.

View File

@@ -1,35 +0,0 @@
---
title: systemd
tags:
- systemd
---
```sh
systemctl list-units
```
```sh
sudo systemctl status mpd
```
```sh
sudo systemctl daemon-reload
```
```sh
sudo systemctl taskd.service start
```
```sh
sudo systemctl status taskd.service
```
# Startup
```sh
sudo systemd-analyze
```
```sh
sudo systemd-analyze blame
```

View File

@@ -1,45 +0,0 @@
---
title: journal
tags:
- systemd
---
See a running log of all system messages:
```sh
journalctl -f
```
Or just one user:
```sh
journalctl --user -f
```
Or just one unit (`sshd`):
```sh
journalctl -f -u sshd
```
Find errors since November
```sh
journalctl --since=2018-11-01 --grep="EXT4-fs error"
```
Limit size to 2G.
```sh
journalctl --vacuum-size=2G
```
Log the fact that you've installed your own `dnsmasq` on your system to `journalctl`, so that you can notice why your system's broken:
```sh
logger "Installed new dnsmasq"
sudo journalctl -f
```

View File

@@ -1,13 +1,23 @@
---
-
title: Making Services
tags:
- systemd
---
# Basics
A service can consist of two files - the .sh script to run, and the .service file which describes its run conditions.
A service can consist of two files - the script to run (usually a shell
script), and the `.service` file which describes when it runs.
The .service file goes in /etc/systemd/system. The scripts themselves might be best placed in $HOME/.local/bin.
The service file goes into the memorably-named directory `/usr/lib/systemd/system/`, where `systemd` will not notice your new service file.
Try not to confuse this with `/usr/share/systemd/` or `/var/lib/systemd/`, but *do*
To make a formal introduction between `systemd` and your service file, reload the daemon and check the list of units.
```sh
sudo systemctl daemon-reload
sudo systemctl list-units | grep ${service}
```
Once you enable the service, `systemd` makes a symbolic link from `/usr/lib/systemd/system/` to `/etc/systemd/system/`.
# Example - tracker.service
@@ -21,18 +31,10 @@ ExecStart=/path/to/script
[Install]
WantedBy=multi-user.target
```
After making the new service, systemd requires reloading:
## Types
```sh
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.
* `simple` - the service runs forever. Other services do not stop it.
* `oneshot` - the service executes once, then stops.

View File

@@ -1,23 +0,0 @@
[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