Compare commits

...

3 Commits

Author SHA1 Message Date
10a345008a test of new service 2024-07-18 19:05:55 +02:00
0dfd0b5747 iptables-persistent relocate 2024-07-18 19:03:40 +02:00
95e179d65d reversing and repairing 2024-07-18 18:46:25 +02:00
2 changed files with 14 additions and 17 deletions

View File

@ -10,22 +10,14 @@ ExecReload=/usr/bin/screen -S minecraft -X stuff \"reload^M\"
ExecStart=/usr/bin/screen -DmS minecraft ./run.sh ExecStart=/usr/bin/screen -DmS minecraft ./run.sh
#ExecStartPre=/bin/sh -c '/usr/bin/screen -dmS mc-perfect'
#ExecStart=/bin/sh -c '/opt/minecraft/run.sh'
#ExecStop=/usr/bin/screen -S minecraft -X stuff \"save-all^M\"
#ExecStop=/bin/sleep 5
#ExecStop=/usr/bin/screen -S minecraft -X stuff \"stop^M\"
#ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\\015' ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\\015'
ExecStop=/bin/sh -c '/bin/sleep 5' ExecStop=/bin/sh -c '/bin/sleep 5'
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "save-all"\\015' ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "save-all"\\015'
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "stop"\\015' ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "stop"\\015'
ExecStop=/bin/sh -c '/bin/sleep 10' ExecStop=/bin/sh -c '/bin/sleep 10'
#Restart=on-failure Restart=on-failure
#RestartSec=60s RestartSec=60s
ProtectControlGroups=true ProtectControlGroups=true
ProtectHome=true ProtectHome=true

View File

@ -4,20 +4,16 @@ printf "Better to run as root, because of permisions handeling.\n"
sleep 2 sleep 2
sudo apt update &
printf "Do you want to set up firewall rules by iptables? [Y/n]: \n" printf "Do you want to set up firewall rules by iptables? [Y/n]: \n"
read ansFirewallSetup read ansFirewallSetup
if [[ "$ansFirewallSetup" =~ ("N"|"n") ]]; then if [[ "$ansFirewallSetup" =~ ("N"|"n") ]]; then
printf "+ Thanks, working on next bit\n" printf "+ Thanks, working on next bit\n"
else
apt install iptables -y else
printf "Do you want to block non-LAN ssh connections? [Y/n/castom]: " printf "Do you want to block non-LAN ssh connections? [Y/n/castom]: "
read sshBlockRange read sshBlockRange
@ -57,12 +53,19 @@ sleep 2
# Just to be shure # Just to be shure
printf "\n+ Starting to upgrade base system\n\n" printf "\n+ Starting to upgrade base system\n\n"
sudo apt update
sudo apt upgrade -y sudo apt upgrade -y
# Installing depandencies # Installing depandencies
printf "\n+ Installing depandencies \n\n" printf "\n+ Installing depandencies \n\n"
sudo apt install openjdk-17-jre-headless screen p7zip-full -y sudo apt install openjdk-17-jre-headless screen p7zip-full -y
if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then
sudo apt install iptables -y
fi
# User and groupe managment # User and groupe managment
printf "\n+ Creating user minecraft and basic file structure" printf "\n+ Creating user minecraft and basic file structure"
groupadd minecraft groupadd minecraft
@ -137,6 +140,8 @@ if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z "$ansFirewallSetup" ]]; then
iptables -P OUTPUT ACCEPT #Allow all outgouing iptables -P OUTPUT ACCEPT #Allow all outgouing
sudo apt install iptables-persistent -y
else else
printf "\nOK it is time for manual configuration" printf "\nOK it is time for manual configuration"
@ -144,7 +149,7 @@ if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z "$ansFirewallSetup" ]]; then
fi fi
apt install iptables-persistent -y
fi fi