This commit is contained in:
Sheppy
2018-09-03 18:44:07 +02:00
commit d339a20c4d
9 changed files with 77 additions and 0 deletions

1
LICENSE Normal file
View File

@@ -0,0 +1 @@
This work does not have the required threshold of originality to be considered for copyright it should therefore be considered to be in the Public Domain.

1
README Normal file
View File

@@ -0,0 +1 @@
TODO

4
example-check-stop.sh Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
# if condition
systemctl stop example.sevice

View File

@@ -0,0 +1,6 @@
[Unit]
Description=Check if unit example.service should be stopped.
[Service]
Type=oneshot
ExecStart=/absolute/path/to/example-check-stop.sh

View File

@@ -0,0 +1,10 @@
[Unit]
Description=Continiously check if example.service should be stopped
After=example.service
PartOf=example.service
[Timer]
OnUnitActiveSec=15min
OnActiveSec=14min
Persistent=false
Unit=sheppy-minecraft-autodeactivate.service

View File

@@ -0,0 +1,10 @@
[Unit]
Description=socket proxy example.service
After=example.service
Requires=example.service
[Service]
ExecStart=/lib/systemd/systemd-socket-proxyd 127.0.0.1:PORT_NUMBER_HERE
[Install]
WantedBy=multi-user.target

32
example.service Normal file
View File

@@ -0,0 +1,32 @@
[Unit]
Description=minecraft server
After=network.target
Requires=sheppy-minecraft-autodeactivate.timer
[Service]
Type=simple
User=minecraft
WorkingDirectory=/home/minecraft/server/
Nice=2
CPUAffinity=0,3
## exit status of mcrcon on success, 143 ist SIGTERM in java, the default for mc
SuccessExitStatus=2 3 143 255
ExecStart=/absolute/path/to/example.sh
ExecStop=pkill example.sh
TimeoutStopSec=30
Restart=always
RestartSec=60
## RES CONTROL ##
MemoryLow=2G
MemoryHigh=4G
## Java VM Limit is 4GB so this should never happen ##
MemoryMax=6G
CPUQuota=100%
[Install]
WantedBy=multi-user.target

2
example.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
sleep 600

11
example.socket Normal file
View File

@@ -0,0 +1,11 @@
[Unit]
Description=Socket Activator for example.service
PartOf=example-proxy.service
[Socket]
ListenStream=PORT_NUMBER_HERE
BindIPv6Only=both
Accept=false
[Install]
WantedBy=multi-user.target