From f19452ddd30e0c35b73d13643c689010ad4ad49c Mon Sep 17 00:00:00 2001 From: godot Date: Fri, 26 Jul 2024 12:57:06 +0200 Subject: [PATCH] systemD service --- README.md | 8 ++++---- data/mc-velocity.service | 31 +++++++++++++++++++++++++++++++ script.sh | 21 +++++++++++++++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 data/mc-velocity.service diff --git a/README.md b/README.md index 9cbd953..f51361d 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,16 @@ - [*] Firewall shinanigns - [*] Proxmox admin acces in firewall - [x] Auto add plugins +- [*] SystemD service - [ ] Config of velocity.toml - [ ] IP +- [*] Tailscale - [ ] Comments of what is doing what -- [ ] Tailscale -- [ ] SystemD service ## To learn - [x] What content of start.sh means +- [ ] Requred resources - [ ] Different types of forwarding - [ ] SkinRestorer??? - [ ] DinMap -- [ ] Requred resources -- [ ] In their docs they have Configuration pages +- [ ] In their docs they have pages diff --git a/data/mc-velocity.service b/data/mc-velocity.service new file mode 100644 index 0000000..ad85f1d --- /dev/null +++ b/data/mc-velocity.service @@ -0,0 +1,31 @@ +[Unit] +Description=Proxy for Minecraft server +After=network.target + +[Install] +WantedBy=multi-user.target + +[Service] +ExecReload=/usr/bin/screen -S velocity -X stuff \"reload^M\" + +ExecStart=/usr/bin/screen -DmS velocity ./start.sh + +ExecStop=/usr/bin/screen -p 0 -S velocity -X eval 'stuff "end"\\015' +ExecStop=/bin/sh -c '/bin/sleep 10' + +Restart=on-failure +RestartSec=60s + +ProtectControlGroups=true +ProtectHome=true +ProtectKernelModules=true +ProtectKernelTunables=true +ProtectSystem=full + +PrivateDevices=true +PrivateUsers=true + +User=velocity +Group=velocity + +WorkingDirectory=/opt/velocity/ diff --git a/script.sh b/script.sh index 8008591..217d141 100755 --- a/script.sh +++ b/script.sh @@ -134,6 +134,27 @@ if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z "$ansFirewallSetup" ]]; then fi fi +### tailsclae install ### + +printf "Do you want to install Tailscale now? [Y/n]: \n" +read ansTail + +if [[ "$ansTail" =~ ("y"|"Y") || -z $ansTail ]]; then + + curl -fsSL https://tailscale.com/install.sh | sh + + + if [[ "$sshBlockRange" =~ ("y"|"Y") || -z $sshBlockRange ]]; then + tailscale up --ssh + + else + tailscale up + + fi + +fi + + ### Start service ### needs update printf "Do you want to start server right now? [Y/n]: \n"