docs: add recipes
This commit is contained in:
parent
30a50585c1
commit
6d3532bc16
3 changed files with 43 additions and 2 deletions
|
|
@ -1,6 +1,4 @@
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
inputs,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
|
|
|
||||||
18
recipes/borg-auth.bash
Executable file
18
recipes/borg-auth.bash
Executable file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
get_key() {
|
||||||
|
hostname=$1
|
||||||
|
ip=$2
|
||||||
|
ssh "admin@$ip" -- 'if [ ! -f /home/admin/.ssh/id_ed25519.pub ]; then ssh-keygen -t ed25519; fi'
|
||||||
|
pubkey=$(ssh "admin@$ip" cat '$HOME/.ssh/id*.pub')
|
||||||
|
echo 'command="mkdir -p /borg/'"$hostname"'; cd /borg/'"$hostname"'; borg serve --restrict-to-path /borg/'"$hostname"'", restrict '"$pubkey"
|
||||||
|
}
|
||||||
|
|
||||||
|
put_key() {
|
||||||
|
hostname=$1
|
||||||
|
ip=$2
|
||||||
|
line=$(get_key "$hostname" "$ip")
|
||||||
|
ssh -t robert@xalicas "sudo -u backup mkdir -p ~backup/.ssh; echo '$line' | sudo -u backup tee -a ~backup/.ssh/authorized_keys"
|
||||||
|
}
|
||||||
|
|
||||||
|
"$@"
|
||||||
25
recipes/minecraft-admin.md
Normal file
25
recipes/minecraft-admin.md
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Minecraft admin
|
||||||
|
|
||||||
|
On the server (`./Taskfile ssh majcraft`),
|
||||||
|
|
||||||
|
## run server commands
|
||||||
|
|
||||||
|
```
|
||||||
|
echo say hello > /run/minecraft/majcraft.stdin
|
||||||
|
```
|
||||||
|
|
||||||
|
## view server output
|
||||||
|
|
||||||
|
```
|
||||||
|
journalctl -xeau minecraft-server-majcraft
|
||||||
|
```
|
||||||
|
|
||||||
|
## shutdown server
|
||||||
|
|
||||||
|
```
|
||||||
|
echo stop > /run/minecraft/majcraft.stdin
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```
|
||||||
|
sudo systemctl stop minecraft-server-majcraft
|
||||||
|
```
|
||||||
Loading…
Add table
Add a link
Reference in a new issue