From 62fd0f92f36e30a18f18a5fbc8af9e8ec76ee1bc Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 13 Dec 2017 17:50:36 -0500 Subject: [PATCH 01/70] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ec95036..5343d36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM debian:stable LABEL maintainer="akshmakov@gmail.com" From 9cd7bd4e32b81fd787ada431fd86307f5ea20265 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 13 Dec 2017 18:00:47 -0500 Subject: [PATCH 02/70] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5343d36..d8ac4bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN dpkg --add-architecture i386 && \ libstdc++6 \ libstdc++6:i386 -ENV LGSM_DOCKER_VERSION 17.07.27 +ENV LGSM_DOCKER_VERSION 17.11.0 ## lgsm.sh RUN wget -N --no-check-certificate https://gameservermanagers.com/dl/linuxgsm.sh From e81e01524efe469fe3e43b81ee39f3880d76f79d Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 13 Dec 2017 18:22:16 -0500 Subject: [PATCH 03/70] changement mineur --- Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d8ac4bc..a1520ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ FROM debian:stable +ENV LGSM_DOCKER_IMAGE LinuxGameServerManager LABEL maintainer="akshmakov@gmail.com" ENV DEBIAN_FRONTEND noninteractive +## Ports Use can use -p port:port also +EXPOSE 27015 7777 7778 27020 + ## Base System RUN dpkg --add-architecture i386 && \ apt-get update -y && \ @@ -24,7 +28,9 @@ RUN dpkg --add-architecture i386 && \ tmux \ lib32gcc1 \ libstdc++6 \ - libstdc++6:i386 + libstdc++6:i386 \ + # ARK Dependancy + lib32gcc1 ENV LGSM_DOCKER_VERSION 17.11.0 @@ -36,7 +42,7 @@ RUN adduser --disabled-password --gecos "" lgsm && \ chown lgsm:lgsm /linuxgsm.sh && \ chmod +x /linuxgsm.sh && \ cp /linuxgsm.sh /home/lgsm/linuxgsm - + USER lgsm WORKDIR /home/lgsm From decec427523a6e9af40a81bb0618cbd94191aec1 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 13 Dec 2017 22:33:05 -0500 Subject: [PATCH 04/70] this commit add two script lgsm.sh this script allow the user to control the server status, start stop and some other stuff lgsm-build.sh allow the user to build the image fast and easy some other stuff like utf-8 bug with tmux solve get some probleme with permission uid gid of the user solve can be see in the code add a crontab command, launch a update from the lgsm script each day at 5am now work on debian base system image from docker some improvement can be done in the script no time today :3 have a nice day. --- Dockerfile | 27 ++++++++++++++---- entrypoint.sh | 3 -- lgsm-build.sh | 3 ++ lgsm.sh | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 8 deletions(-) create mode 100755 lgsm-build.sh create mode 100755 lgsm.sh diff --git a/Dockerfile b/Dockerfile index a1520ae..c222214 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,9 @@ FROM debian:stable ENV LGSM_DOCKER_IMAGE LinuxGameServerManager LABEL maintainer="akshmakov@gmail.com" +## Edit By Jkljkl1197 -ENV DEBIAN_FRONTEND noninteractive +#ENV DEBIAN_FRONTEND noninteractive ## Ports Use can use -p port:port also EXPOSE 27015 7777 7778 27020 @@ -29,19 +30,35 @@ RUN dpkg --add-architecture i386 && \ lib32gcc1 \ libstdc++6 \ libstdc++6:i386 \ - # ARK Dependancy - lib32gcc1 + # ARK Dependancy/some add by me + lib32gcc1 \ + cron \ + bc \ + nano \ + procps \ + locales ENV LGSM_DOCKER_VERSION 17.11.0 +## UTF-8 Probleme ... +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + locale-gen +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + ## lgsm.sh RUN wget -N --no-check-certificate https://gameservermanagers.com/dl/linuxgsm.sh +## if you have a permission probleme, check the with command id of the real machine user lgsm +## you need to have the same guid and uid as your real machine storage/data folder +## for me my real user is 1001 so i need to create a user for the machine with the same uid... ## user config -RUN adduser --disabled-password --gecos "" lgsm && \ +RUN adduser --disabled-password --gecos "" --uid 1001 lgsm && \ chown lgsm:lgsm /linuxgsm.sh && \ chmod +x /linuxgsm.sh && \ - cp /linuxgsm.sh /home/lgsm/linuxgsm + cp /linuxgsm.sh /home/lgsm/linuxgsm.sh && \ + usermod -G tty lgsm USER lgsm WORKDIR /home/lgsm diff --git a/entrypoint.sh b/entrypoint.sh index 9e591f9..0f8764e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,7 +11,6 @@ ## then we must keep a backup copy of the script on local drive if [ ! -e ~/linuxgsm ]; then echo "Initializing Linuxgsm User Script in New Volume" - cp /linuxgsm.sh ./linuxgsm fi # with no command, just spawn a running container suitable for exec's @@ -31,6 +30,4 @@ else tmux set -g status off && tmux attach 2> /dev/null fi - - exit 0 diff --git a/lgsm-build.sh b/lgsm-build.sh new file mode 100755 index 0000000..ba1cd20 --- /dev/null +++ b/lgsm-build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo docker build -t lgsm-docker . diff --git a/lgsm.sh b/lgsm.sh new file mode 100755 index 0000000..83efc5a --- /dev/null +++ b/lgsm.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +## can be simplified. + +## name of the docker process +InstanceName="arkserver" +## arkserver for me (it's the script name in the serveur directory) +ServerType="arkserver" +## Image name to run (i have build with the lgsm-build.sh) +Img="lgsm-docker" + +if [ $1 != null ] +then + echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|cronjob}" + cmd=$@ +else + echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|cronjob}" + read -a cmd +fi + + +case $cmd in + "install") + read -a type + sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null + sudo docker exec $InstanceName $ServerType install $type + ;; + + "start") + sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null + sudo docker exec $InstanceName $ServerType start + ;; + + "stop") + sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null + sudo docker exec $InstanceName $ServerType stop + sudo docker kill $InstanceName + ;; + + "restart") + sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null + sudo docker exec $InstanceName $ServerType restart + ;; + + "console") + sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null + sudo docker exec $InstanceName $ServerType console + ;; + + "monitor") + sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null + sudo docker exec $InstanceName $ServerType monitor + ;; + + "update") ## update stop the server if is already running. + sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash + sudo docker exec $InstanceName $ServerType update + ;; + + "backup") + sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash + sudo docker exec $InstanceName $ServerType backup + ;; + + "conjob") ## need to be test. + sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash + sudo docker exec $InstanceName crontab -l > tempcronfile + sudo docker exec $InstanceName echo "0 5 * * * /home/lgsm/$ServerType update > /dev/null 2>&1" > tempcronfile + sudo docker exec $InstanceName crontab tempcronfile && rm tempcronfile + ;; + + *) + echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup}" + exit 1 + +esac + +#sudo docker run --name arkserver --rm -it -d -v "/home/lgsm/:/home/lgsm" lgsm-docker bash $@ From c24dac5de351950a6c5337ae88e87e3364f026b3 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 13 Dec 2017 22:46:30 -0500 Subject: [PATCH 05/70] Update entrypoint.sh --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 0f8764e..39766ac 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,6 +11,7 @@ ## then we must keep a backup copy of the script on local drive if [ ! -e ~/linuxgsm ]; then echo "Initializing Linuxgsm User Script in New Volume" + cp /linuxgsm.sh ./linuxgsm fi # with no command, just spawn a running container suitable for exec's From c880fff6beb473c971531059855ede251b784480 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 13 Dec 2017 22:51:37 -0500 Subject: [PATCH 06/70] Update Dockerfile --- Dockerfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index c222214..1f1d9e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,7 @@ RUN dpkg --add-architecture i386 && \ lib32gcc1 \ libstdc++6 \ libstdc++6:i386 \ - # ARK Dependancy/some add by me + # add some dependency/script needs lib32gcc1 \ cron \ bc \ @@ -41,8 +41,7 @@ RUN dpkg --add-architecture i386 && \ ENV LGSM_DOCKER_VERSION 17.11.0 ## UTF-8 Probleme ... -RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ - locale-gen +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 @@ -50,15 +49,15 @@ ENV LC_ALL en_US.UTF-8 ## lgsm.sh RUN wget -N --no-check-certificate https://gameservermanagers.com/dl/linuxgsm.sh -## if you have a permission probleme, check the with command id of the real machine user lgsm +## if you have a permission probleme, check uid gid with the command id of the real machine user lgsm ## you need to have the same guid and uid as your real machine storage/data folder -## for me my real user is 1001 so i need to create a user for the machine with the same uid... +## for me, my real user uid is 1001 so i need to create a user for the virtual docker image with the same uid ## user config RUN adduser --disabled-password --gecos "" --uid 1001 lgsm && \ chown lgsm:lgsm /linuxgsm.sh && \ chmod +x /linuxgsm.sh && \ cp /linuxgsm.sh /home/lgsm/linuxgsm.sh && \ - usermod -G tty lgsm + usermod -G tty lgsm #solve ark script error USER lgsm WORKDIR /home/lgsm @@ -67,7 +66,6 @@ WORKDIR /home/lgsm ENV TERM=xterm ## Docker Details - ENV PATH=$PATH:/home/lgsm COPY entrypoint.sh /entrypoint.sh From bf5a560e3f0b7022f95c2155394e457745b322a8 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 13 Dec 2017 22:51:54 -0500 Subject: [PATCH 07/70] Update Dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1f1d9e6..d8ff257 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,6 @@ FROM debian:stable ENV LGSM_DOCKER_IMAGE LinuxGameServerManager LABEL maintainer="akshmakov@gmail.com" -## Edit By Jkljkl1197 #ENV DEBIAN_FRONTEND noninteractive From dc328097126e6cd4451c2b1e4936bed343503ec8 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 13 Dec 2017 22:52:53 -0500 Subject: [PATCH 08/70] Update lgsm-build.sh --- lgsm-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/lgsm-build.sh b/lgsm-build.sh index ba1cd20..32e458f 100755 --- a/lgsm-build.sh +++ b/lgsm-build.sh @@ -1,3 +1,4 @@ #!/bin/bash +## simple building script to create the image/container sudo docker build -t lgsm-docker . From 693d9daec11701c9e1032a0b9464c44e2d865250 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 13 Dec 2017 22:58:26 -0500 Subject: [PATCH 09/70] ReadMe this readme can be better ^^. --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 76132eb..b68072a 100644 --- a/README.md +++ b/README.md @@ -178,5 +178,10 @@ These quirks are This Container runs `linuxgsm.sh` under a generic user `lgsm` and script and server data installed under the home directory `/home/lgsm` +## easy step - +- Download the git repo git clone ... +- Change permission to executable : chmod +x lgsm-build.sh && chmod +x lgsm.sh +- Execute lgsm-build.sh +- Edit some variable at the top of the lgsm.sh script +- Execute lgsm.sh From 241cddbff6ecf233025b145220ffd6a3e025b44d Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 13 Dec 2017 22:59:26 -0500 Subject: [PATCH 10/70] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b68072a..d2727d2 100644 --- a/README.md +++ b/README.md @@ -184,4 +184,4 @@ This Container runs `linuxgsm.sh` under a generic user `lgsm` and script and se - Change permission to executable : chmod +x lgsm-build.sh && chmod +x lgsm.sh - Execute lgsm-build.sh - Edit some variable at the top of the lgsm.sh script -- Execute lgsm.sh +- Execute lgsm.sh all you need is in this script From fa25c3b53c206e31ab3075c2033e21b8b4c9d992 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 18:48:31 -0500 Subject: [PATCH 11/70] big edit to get work well lgsm.sh, delete useless repetition add some conditions. --- lgsm.sh | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/lgsm.sh b/lgsm.sh index 83efc5a..65bc3e7 100755 --- a/lgsm.sh +++ b/lgsm.sh @@ -9,12 +9,25 @@ ServerType="arkserver" ## Image name to run (i have build with the lgsm-build.sh) Img="lgsm-docker" -if [ $1 != null ] +## check if the container already running (true or '') +status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) + +if [ "$status" != "true" ] && [ $1 != "stop" ] +then + echo "docker container was not running. start it for you." + sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null +elif [ "$status" == "true" ] +then + echo "docker container already running, append command." +else + echo "docker container not running." +fi + +if [ "$1" != "" ] then - echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|cronjob}" - cmd=$@ + cmd=$1 else - echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|cronjob}" + echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|attach|command|cronjob}" read -a cmd fi @@ -22,55 +35,58 @@ fi case $cmd in "install") read -a type - sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null sudo docker exec $InstanceName $ServerType install $type ;; "start") - sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null sudo docker exec $InstanceName $ServerType start ;; "stop") - sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null - sudo docker exec $InstanceName $ServerType stop - sudo docker kill $InstanceName + if [ "$status" == "true" ] + then + sudo docker exec $InstanceName $ServerType stop + sudo docker kill $InstanceName + fi ;; "restart") - sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null sudo docker exec $InstanceName $ServerType restart ;; "console") - sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null sudo docker exec $InstanceName $ServerType console ;; "monitor") - sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null sudo docker exec $InstanceName $ServerType monitor ;; - "update") ## update stop the server if is already running. - sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash + "update") ## update stop the server if is already running(lgsm script). sudo docker exec $InstanceName $ServerType update ;; "backup") - sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash sudo docker exec $InstanceName $ServerType backup ;; "conjob") ## need to be test. - sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash sudo docker exec $InstanceName crontab -l > tempcronfile sudo docker exec $InstanceName echo "0 5 * * * /home/lgsm/$ServerType update > /dev/null 2>&1" > tempcronfile sudo docker exec $InstanceName crontab tempcronfile && rm tempcronfile ;; + "attach") + sudo docker attach $InstanceName + ;; + + "command") + echo "input the complete command to execute in virtual container" + read -a $command + sudo docker exec $InstanceName $command + ;; + *) - echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup}" exit 1 esac From cc6675eb644e9b1296c14a8423bb177f0a25cd51 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 19:00:54 -0500 Subject: [PATCH 12/70] README update add feature section --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index d2727d2..0a812a0 100644 --- a/README.md +++ b/README.md @@ -180,8 +180,16 @@ This Container runs `linuxgsm.sh` under a generic user `lgsm` and script and se ## easy step +the script create a user name lgsm app path is /home/lgsm/ + - Download the git repo git clone ... - Change permission to executable : chmod +x lgsm-build.sh && chmod +x lgsm.sh - Execute lgsm-build.sh - Edit some variable at the top of the lgsm.sh script - Execute lgsm.sh all you need is in this script + +## features to add + +- Install script +- Multi-lgsm server type on one lgsm install +- Support all server type depency in function bash From 2f5e52e11f52113177d65dc72147d3804b349cd6 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 19:01:34 -0500 Subject: [PATCH 13/70] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0a812a0..3d47e40 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ then any extended image may be run as such ``` # build the custom image $ docker build -tag local/linuxgsm:$SERVERNAME . -# start the server +sudo docker run --name arkserver --rm -it -d -v "/home/lgsm/:/home/lgsm" lgsm-docker bash# start the server $ docker run -d --name my-custom-server local/linuxgsm:$SERVERNAME ``` @@ -178,7 +178,7 @@ These quirks are This Container runs `linuxgsm.sh` under a generic user `lgsm` and script and server data installed under the home directory `/home/lgsm` -## easy step +## Easy step the script create a user name lgsm app path is /home/lgsm/ @@ -188,7 +188,7 @@ the script create a user name lgsm app path is /home/lgsm/ - Edit some variable at the top of the lgsm.sh script - Execute lgsm.sh all you need is in this script -## features to add +## Features to add - Install script - Multi-lgsm server type on one lgsm install From 92f26f53cae6ab45a00e350c114953e855ecbc93 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 19:10:09 -0500 Subject: [PATCH 14/70] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3d47e40..673c00f 100644 --- a/README.md +++ b/README.md @@ -188,8 +188,8 @@ the script create a user name lgsm app path is /home/lgsm/ - Edit some variable at the top of the lgsm.sh script - Execute lgsm.sh all you need is in this script -## Features to add +## TODO -- Install script +- Install script to et variable in script automaticaly - Multi-lgsm server type on one lgsm install -- Support all server type depency in function bash +- Support all server type depency in a function bash From a111406c1961cc3842df5fe630333ad74540c865 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 19:10:48 -0500 Subject: [PATCH 15/70] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 673c00f..ff7aae2 100644 --- a/README.md +++ b/README.md @@ -190,6 +190,6 @@ the script create a user name lgsm app path is /home/lgsm/ ## TODO -- Install script to et variable in script automaticaly +- Install script to edit variable in script automaticaly - Multi-lgsm server type on one lgsm install - Support all server type depency in a function bash From a23e77141940df347b6a5c0efebceeb9d5cff635 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 19:11:53 -0500 Subject: [PATCH 16/70] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff7aae2..cad7c01 100644 --- a/README.md +++ b/README.md @@ -192,4 +192,4 @@ the script create a user name lgsm app path is /home/lgsm/ - Install script to edit variable in script automaticaly - Multi-lgsm server type on one lgsm install -- Support all server type depency in a function bash +- Support all server type depency and port in a function bash From c806951b637f6e113c353786fd1cbf07dd827f19 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 19:12:15 -0500 Subject: [PATCH 17/70] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cad7c01..d8c7236 100644 --- a/README.md +++ b/README.md @@ -192,4 +192,4 @@ the script create a user name lgsm app path is /home/lgsm/ - Install script to edit variable in script automaticaly - Multi-lgsm server type on one lgsm install -- Support all server type depency and port in a function bash +- Support all server type depency and default port in a function bash From d3604fc92a7ffd6df54d988fffbae8c8c6667e40 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 19:14:45 -0500 Subject: [PATCH 18/70] tiny error on line 15 forget "" --- lgsm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lgsm.sh b/lgsm.sh index 65bc3e7..272c7df 100755 --- a/lgsm.sh +++ b/lgsm.sh @@ -12,7 +12,7 @@ Img="lgsm-docker" ## check if the container already running (true or '') status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) -if [ "$status" != "true" ] && [ $1 != "stop" ] +if [ "$status" != "true" ] && [ "$1" != "stop" ] then echo "docker container was not running. start it for you." sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null From aa106dc7345ded12699cccf2b29cdd99b32e5d65 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 19:48:47 -0500 Subject: [PATCH 19/70] change maintainer --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d8ff257..0a54013 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM debian:stable ENV LGSM_DOCKER_IMAGE LinuxGameServerManager -LABEL maintainer="akshmakov@gmail.com" +LABEL maintainer="jkljkl1197 on github" #ENV DEBIAN_FRONTEND noninteractive From e060a4ebbbf81e54690d80f229919a1f9d830434 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 19:51:06 -0500 Subject: [PATCH 20/70] remove a invalide package and add apt-utils --- Dockerfile | 77 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 27 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0a54013..2fcd904 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,39 +3,62 @@ FROM debian:stable ENV LGSM_DOCKER_IMAGE LinuxGameServerManager LABEL maintainer="jkljkl1197 on github" -#ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_FRONTEND noninteractive ## Ports Use can use -p port:port also EXPOSE 27015 7777 7778 27020 +## Base System ## Base System RUN dpkg --add-architecture i386 && \ - apt-get update -y && \ - apt-get install -y \ - binutils \ - mailutils \ - postfix \ - curl \ - wget \ - file \ - bzip2 \ - gzip \ - unzip \ - bsdmainutils \ - python \ - util-linux \ - ca-certificates \ - tmux \ - lib32gcc1 \ - libstdc++6 \ - libstdc++6:i386 \ - # add some dependency/script needs - lib32gcc1 \ - cron \ - bc \ - nano \ - procps \ - locales + apt-get update -y && \ + apt-get install -y \ + binutils \ + mailutils \ + postfix \ + bc \ + curl \ + wget \ + file \ + bzip2 \ + gzip \ + unzip \ + xz-utils \ + libmariadb2 \ + bsdmainutils \ + python \ + util-linux \ + ca-certificates \ + tmux \ + lib32gcc1 \ + libstdc++6 \ + libstdc++6:i386 \ + libstdc++5:i386 \ + libsdl1.2debian \ + default-jdk \ + lib32tinfo5 \ + speex:i386 \ + libtbb2 \ + libcurl4-gnutls-dev:i386 \ + libtcmalloc-minimal4:i386 \ + libncurses5:i386 \ + zlib1g:i386 \ + libldap-2.4-2:i386 \ + libxrandr2:i386 \ + libglu1-mesa:i386 \ + libxtst6:i386 \ + libusb-1.0-0-dev:i386 \ + libxxf86vm1:i386 \ + libopenal1:i386 \ + libgtk2.0-0:i386 \ + libdbus-glib-1-2:i386 \ + libnm-glib-dev:i386 \ + cron \ + procps \ + locales \ + ## just to have a simple text editor. + nano \ + apt-utils ENV LGSM_DOCKER_VERSION 17.11.0 From 9d8c298319ca8aa4fea04974758f2b4f92bb87ac Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 20:38:50 -0500 Subject: [PATCH 21/70] change position of apt-utils because can get use by other package for the intallation. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2fcd904..07746ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ EXPOSE 27015 7777 7778 27020 RUN dpkg --add-architecture i386 && \ apt-get update -y && \ apt-get install -y \ + apt-utils \ binutils \ mailutils \ postfix \ @@ -58,7 +59,6 @@ RUN dpkg --add-architecture i386 && \ locales \ ## just to have a simple text editor. nano \ - apt-utils ENV LGSM_DOCKER_VERSION 17.11.0 From e8d497f0f12a2a10f3f083daa7207699c42c261f Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 20:41:55 -0500 Subject: [PATCH 22/70] error with comments in run section???# --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 07746ce..bfd8bd4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,7 +57,6 @@ RUN dpkg --add-architecture i386 && \ cron \ procps \ locales \ - ## just to have a simple text editor. nano \ ENV LGSM_DOCKER_VERSION 17.11.0 From 9142cf433c641047d628287fc485fcb76095367f Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 14 Dec 2017 21:58:04 -0500 Subject: [PATCH 23/70] repair some udp ports probleme and some other stuff --- Dockerfile | 97 +++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/Dockerfile b/Dockerfile index bfd8bd4..b3abfe8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,58 +6,59 @@ LABEL maintainer="jkljkl1197 on github" ENV DEBIAN_FRONTEND noninteractive ## Ports Use can use -p port:port also -EXPOSE 27015 7777 7778 27020 +EXPOSE 27015:27015 7777:7777 7778:7778 27020:27020 443:443 80:80 \ + 27015:27015/udp 7777:7777/udp 7778:7778/udp 27020:27020/udp 443:443/udp 80:80/udp -## Base System ## Base System RUN dpkg --add-architecture i386 && \ apt-get update -y && \ - apt-get install -y \ - apt-utils \ - binutils \ - mailutils \ - postfix \ - bc \ - curl \ - wget \ - file \ - bzip2 \ - gzip \ - unzip \ - xz-utils \ - libmariadb2 \ - bsdmainutils \ - python \ - util-linux \ - ca-certificates \ - tmux \ - lib32gcc1 \ - libstdc++6 \ - libstdc++6:i386 \ - libstdc++5:i386 \ - libsdl1.2debian \ - default-jdk \ - lib32tinfo5 \ - speex:i386 \ - libtbb2 \ - libcurl4-gnutls-dev:i386 \ - libtcmalloc-minimal4:i386 \ - libncurses5:i386 \ - zlib1g:i386 \ - libldap-2.4-2:i386 \ - libxrandr2:i386 \ - libglu1-mesa:i386 \ - libxtst6:i386 \ - libusb-1.0-0-dev:i386 \ - libxxf86vm1:i386 \ - libopenal1:i386 \ - libgtk2.0-0:i386 \ - libdbus-glib-1-2:i386 \ - libnm-glib-dev:i386 \ - cron \ - procps \ - locales \ - nano \ + apt-get install -y --no-install-recommends apt-utils +## Dependency +RUN apt-get install -y \ + binutils \ + mailutils \ + postfix \ + bc \ + curl \ + wget \ + file \ + bzip2 \ + gzip \ + unzip \ + xz-utils \ + libmariadb2 \ + bsdmainutils \ + python \ + util-linux \ + ca-certificates \ + tmux \ + lib32gcc1 \ + libstdc++6 \ + libstdc++6:i386 \ + libstdc++5:i386 \ + libsdl1.2debian \ + default-jdk \ + lib32tinfo5 \ + speex:i386 \ + libtbb2 \ + libcurl4-gnutls-dev:i386 \ + libtcmalloc-minimal4:i386 \ + libncurses5:i386 \ + zlib1g:i386 \ + libldap-2.4-2:i386 \ + libxrandr2:i386 \ + libglu1-mesa:i386 \ + libxtst6:i386 \ + libusb-1.0-0-dev:i386 \ + libxxf86vm1:i386 \ + libopenal1:i386 \ + libgtk2.0-0:i386 \ + libdbus-glib-1-2:i386 \ + libnm-glib-dev:i386 \ + cron \ + procps \ + locales \ + nano ENV LGSM_DOCKER_VERSION 17.11.0 From e762aafd7a16ce5343d3020dcbcf2ddfdb1d9fbb Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Fri, 15 Dec 2017 00:15:10 -0500 Subject: [PATCH 24/70] some edit --- lgsm.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lgsm.sh b/lgsm.sh index 272c7df..59e0147 100755 --- a/lgsm.sh +++ b/lgsm.sh @@ -3,11 +3,11 @@ ## can be simplified. ## name of the docker process -InstanceName="arkserver" +InstanceName='arkserver' ## arkserver for me (it's the script name in the serveur directory) -ServerType="arkserver" +ServerType='arkserver' ## Image name to run (i have build with the lgsm-build.sh) -Img="lgsm-docker" +Img='lgsm-docker' ## check if the container already running (true or '') status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) @@ -15,7 +15,7 @@ status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev if [ "$status" != "true" ] && [ "$1" != "stop" ] then echo "docker container was not running. start it for you." - sudo docker run --name $InstanceName --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null + sudo docker run --name $InstanceName --hostname LGSM --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null elif [ "$status" == "true" ] then echo "docker container already running, append command." @@ -72,18 +72,19 @@ case $cmd in "conjob") ## need to be test. sudo docker exec $InstanceName crontab -l > tempcronfile - sudo docker exec $InstanceName echo "0 5 * * * /home/lgsm/$ServerType update > /dev/null 2>&1" > tempcronfile + sudo docker exec $InstanceName echo "0 5 * * * su - root -C '/root/dockerbuild/LinuxGSM-docker/lgsm.sh update' >/dev/null 2>&1" sudo docker exec $InstanceName crontab tempcronfile && rm tempcronfile ;; "attach") + echo "dettach with ctrl+p & ctrl+q" sudo docker attach $InstanceName ;; - "command") + "command") ## not working. 1 hour of try echo "input the complete command to execute in virtual container" - read -a $command - sudo docker exec $InstanceName $command + read -a test + sudo docker exec $InstanceName $test ;; *) From 83a27f54081da087845d45400938130866b5df9a Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Fri, 15 Dec 2017 21:05:47 -0500 Subject: [PATCH 25/70] add a discord alerts sender shell and do some edit about it in lgsm.sh --- alert_discord-base.sh | 83 +++++++++++++++++++++++++++++++++++++++++++ lgsm.sh | 11 +++++- 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100755 alert_discord-base.sh diff --git a/alert_discord-base.sh b/alert_discord-base.sh new file mode 100755 index 0000000..0cc9aaa --- /dev/null +++ b/alert_discord-base.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# LinuxGSM alert_discord.sh function +# Author: Daniel Gibbs +# Contributor: faflfama +# Website: https://gameservermanagers.com +# Description: Sends Discord alert. + +discordwebhook="https://discordapp.com/api/webhooks/391048323764584448/fACpwVm58eReQPLm9QdrzYnRYC8SDolq3A20xXLvb5G2Gk70rCGg4Vr9o3UKiygrmU46" + +avatar="https://image.freepik.com/vector-gratis/fondo-pixelador-de-game-over_1051-1014.jpg" + +if [ "$1" == "start" ] +then + titre="ARK Start" + alertMessage="Le serveur est en cour de démarrage!" + state="En cour" + icon="http://wfarm4.dataknet.com/static/resources/icons/set58/8daa4286.png" +elif [ "$1" == "stop" ] +then + titre="ARK Stop" + alertMessage="Le serveur est maintenant étein..." + state="Indisponible" + icon="http://iconshow.me/media/images/Mixed/small-n-flat-icon/png2/512/-sign-ban.png" +elif [ "$1" == "update" ] +then + titre="ARK Update" + alertMessage="Le serveur est cour de mise a jour!!!" + state="En mise à jour" + icon="https://vignette.wikia.nocookie.net/scream-queens/images/8/88/Update-icon.png" +elif [ "$1" == "restart" ] +then + titre="ARK restart" + alertMessage="Le serveur est en cour de redémarrage" + state="En redémarrage" + icon="https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Antu_appointment-recurring.svg/2000px-Antu_appointment-recurring.svg.png" +fi + +json=$(cat < /dev if [ "$status" != "true" ] && [ "$1" != "stop" ] then echo "docker container was not running. start it for you." - sudo docker run --name $InstanceName --hostname LGSM --rm -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null + sudo docker rm $InstanceName 2> /dev/null + sudo docker run --name $InstanceName --restart always --hostname LGSM -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null elif [ "$status" == "true" ] then echo "docker container already running, append command." @@ -40,18 +41,24 @@ case $cmd in "start") sudo docker exec $InstanceName $ServerType start + sleep 2 + sudo docker exec $InstanceName alert_discord.sh ;; "stop") if [ "$status" == "true" ] then sudo docker exec $InstanceName $ServerType stop + sudo docker exec $InstanceName alert_discord.sh stop + sleep 4 sudo docker kill $InstanceName fi ;; "restart") sudo docker exec $InstanceName $ServerType restart + sleep 2 + sudo docker exec $InstanceName alert_discord.sh restart ;; "console") @@ -64,6 +71,8 @@ case $cmd in "update") ## update stop the server if is already running(lgsm script). sudo docker exec $InstanceName $ServerType update + sleep 2 + sudo docker exec $InstanceName alert_discord.sh update ;; "backup") From 01fb53a022dc03d63c0331f1c430eb4e83f82924 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Fri, 15 Dec 2017 21:10:02 -0500 Subject: [PATCH 26/70] Update alert_discord-base.sh --- alert_discord-base.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/alert_discord-base.sh b/alert_discord-base.sh index 0cc9aaa..91054fa 100755 --- a/alert_discord-base.sh +++ b/alert_discord-base.sh @@ -5,7 +5,8 @@ # Website: https://gameservermanagers.com # Description: Sends Discord alert. -discordwebhook="https://discordapp.com/api/webhooks/391048323764584448/fACpwVm58eReQPLm9QdrzYnRYC8SDolq3A20xXLvb5G2Gk70rCGg4Vr9o3UKiygrmU46" +# your webhook +discordwebhook="" avatar="https://image.freepik.com/vector-gratis/fondo-pixelador-de-game-over_1051-1014.jpg" @@ -60,7 +61,7 @@ json=$(cat < Date: Fri, 15 Dec 2017 21:49:25 -0500 Subject: [PATCH 27/70] some edit --- lgsm.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lgsm.sh b/lgsm.sh index 4680632..7cbf0e9 100755 --- a/lgsm.sh +++ b/lgsm.sh @@ -42,23 +42,21 @@ case $cmd in "start") sudo docker exec $InstanceName $ServerType start sleep 2 - sudo docker exec $InstanceName alert_discord.sh + sudo docker exec $InstanceName alert_discord.sh start ;; "stop") if [ "$status" == "true" ] then - sudo docker exec $InstanceName $ServerType stop sudo docker exec $InstanceName alert_discord.sh stop - sleep 4 + sudo docker exec $InstanceName $ServerType stop sudo docker kill $InstanceName fi ;; "restart") - sudo docker exec $InstanceName $ServerType restart - sleep 2 sudo docker exec $InstanceName alert_discord.sh restart + sudo docker exec $InstanceName $ServerType restart ;; "console") @@ -70,9 +68,8 @@ case $cmd in ;; "update") ## update stop the server if is already running(lgsm script). - sudo docker exec $InstanceName $ServerType update - sleep 2 sudo docker exec $InstanceName alert_discord.sh update + sudo docker exec $InstanceName $ServerType update ;; "backup") From 43ec5d253b068539f61c65c333ddaa605d20dbef Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Sun, 17 Dec 2017 13:13:11 -0500 Subject: [PATCH 28/70] all work now contact from external network ... --- Dockerfile | 3 ++- lgsm.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b3abfe8..00ec950 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,7 +58,8 @@ RUN apt-get install -y \ cron \ procps \ locales \ - nano + nano \ + net-tools ENV LGSM_DOCKER_VERSION 17.11.0 diff --git a/lgsm.sh b/lgsm.sh index 7cbf0e9..c977390 100755 --- a/lgsm.sh +++ b/lgsm.sh @@ -16,7 +16,7 @@ if [ "$status" != "true" ] && [ "$1" != "stop" ] then echo "docker container was not running. start it for you." sudo docker rm $InstanceName 2> /dev/null - sudo docker run --name $InstanceName --restart always --hostname LGSM -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null + sudo docker run --name $InstanceName --restart always --net=host --hostname LGSM -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null elif [ "$status" == "true" ] then echo "docker container already running, append command." From 5c68182b8eef62bb397351cbe177bbec48a59e8b Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Tue, 16 Jan 2018 19:38:12 -0500 Subject: [PATCH 29/70] some little edit --- alert_discord-base.sh | 0 lgsm.sh | 6 ++---- 2 files changed, 2 insertions(+), 4 deletions(-) mode change 100755 => 100644 alert_discord-base.sh diff --git a/alert_discord-base.sh b/alert_discord-base.sh old mode 100755 new mode 100644 diff --git a/lgsm.sh b/lgsm.sh index c977390..9751e9e 100755 --- a/lgsm.sh +++ b/lgsm.sh @@ -87,10 +87,8 @@ case $cmd in sudo docker attach $InstanceName ;; - "command") ## not working. 1 hour of try - echo "input the complete command to execute in virtual container" - read -a test - sudo docker exec $InstanceName $test + "command") + sudo docker exec -it $InstanceName $2 $3 $4 $5 ;; *) From 0e8ad7693ed9350d09b0f239bc8704130e5e5d44 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Tue, 16 Jan 2018 19:39:37 -0500 Subject: [PATCH 30/70] rename linuxgsm-build.sh to linuxgsm-docker-build.sh --- lgsm-build.sh => linuxgsm-docker-build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lgsm-build.sh => linuxgsm-docker-build.sh (100%) diff --git a/lgsm-build.sh b/linuxgsm-docker-build.sh similarity index 100% rename from lgsm-build.sh rename to linuxgsm-docker-build.sh From 687abbf1491bd0ce22d8ab26878ce6be15bbe116 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Tue, 16 Jan 2018 19:41:01 -0500 Subject: [PATCH 31/70] rename lgsm.sh to linuxgsm-docker.sh --- lgsm.sh => linuxgsm-docker.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lgsm.sh => linuxgsm-docker.sh (100%) diff --git a/lgsm.sh b/linuxgsm-docker.sh similarity index 100% rename from lgsm.sh rename to linuxgsm-docker.sh From d572538fc90e57854fe2b6e40b4152bcc6d4941b Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Tue, 16 Jan 2018 19:43:02 -0500 Subject: [PATCH 32/70] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d8c7236..30b9ef0 100644 --- a/README.md +++ b/README.md @@ -184,8 +184,8 @@ the script create a user name lgsm app path is /home/lgsm/ - Download the git repo git clone ... - Change permission to executable : chmod +x lgsm-build.sh && chmod +x lgsm.sh -- Execute lgsm-build.sh -- Edit some variable at the top of the lgsm.sh script +- Execute linuxgsm-docker-build.sh +- Edit some variable at the top of the linuxgsm-docker.sh script - Execute lgsm.sh all you need is in this script ## TODO From 34e4b00ef2fef1b744e1d44e5097e5d942bc5a75 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Tue, 16 Jan 2018 19:53:44 -0500 Subject: [PATCH 33/70] Delete alert_discord-base.sh --- alert_discord-base.sh | 84 ------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 alert_discord-base.sh diff --git a/alert_discord-base.sh b/alert_discord-base.sh deleted file mode 100644 index 91054fa..0000000 --- a/alert_discord-base.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# LinuxGSM alert_discord.sh function -# Author: Daniel Gibbs -# Contributor: faflfama -# Website: https://gameservermanagers.com -# Description: Sends Discord alert. - -# your webhook -discordwebhook="" - -avatar="https://image.freepik.com/vector-gratis/fondo-pixelador-de-game-over_1051-1014.jpg" - -if [ "$1" == "start" ] -then - titre="ARK Start" - alertMessage="Le serveur est en cour de démarrage!" - state="En cour" - icon="http://wfarm4.dataknet.com/static/resources/icons/set58/8daa4286.png" -elif [ "$1" == "stop" ] -then - titre="ARK Stop" - alertMessage="Le serveur est maintenant étein..." - state="Indisponible" - icon="http://iconshow.me/media/images/Mixed/small-n-flat-icon/png2/512/-sign-ban.png" -elif [ "$1" == "update" ] -then - titre="ARK Update" - alertMessage="Le serveur est cour de mise a jour!!!" - state="En mise à jour" - icon="https://vignette.wikia.nocookie.net/scream-queens/images/8/88/Update-icon.png" -elif [ "$1" == "restart" ] -then - titre="ARK restart" - alertMessage="Le serveur est en cour de redémarrage" - state="En redémarrage" - icon="https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Antu_appointment-recurring.svg/2000px-Antu_appointment-recurring.svg.png" -fi - -json=$(cat < Date: Tue, 16 Jan 2018 20:05:23 -0500 Subject: [PATCH 34/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 9751e9e..57bcf2b 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -8,6 +8,8 @@ InstanceName='arkserver' ServerType='arkserver' ## Image name to run (i have build with the lgsm-build.sh) Img='lgsm-docker' +## current path; plz execute this script from it folder +Path=`pwd` ## check if the container already running (true or '') status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) @@ -28,7 +30,7 @@ if [ "$1" != "" ] then cmd=$1 else - echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|attach|command|cronjob}" + echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|attach|command}" read -a cmd fi @@ -76,11 +78,9 @@ case $cmd in sudo docker exec $InstanceName $ServerType backup ;; - "conjob") ## need to be test. - sudo docker exec $InstanceName crontab -l > tempcronfile - sudo docker exec $InstanceName echo "0 5 * * * su - root -C '/root/dockerbuild/LinuxGSM-docker/lgsm.sh update' >/dev/null 2>&1" - sudo docker exec $InstanceName crontab tempcronfile && rm tempcronfile - ;; + #"conjob") ## as been tested but need a custom path ... + # need to find a way to add this line in crontab of the main linux "* */3 * * * bash ${Path}/linuxgsm-docker.sh command bash check_version.sh >/dev/null 2>&1" + # ;; "attach") echo "dettach with ctrl+p & ctrl+q" @@ -88,6 +88,7 @@ case $cmd in ;; "command") + # need to find a way to use all parameter after the first one, but work for now ... sudo docker exec -it $InstanceName $2 $3 $4 $5 ;; From 88c797bb66122d6ddd72809bff4f655b6574fcf5 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Tue, 16 Jan 2018 20:20:54 -0500 Subject: [PATCH 35/70] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30b9ef0..c63296a 100644 --- a/README.md +++ b/README.md @@ -182,11 +182,13 @@ This Container runs `linuxgsm.sh` under a generic user `lgsm` and script and se the script create a user name lgsm app path is /home/lgsm/ +PS: you need to have a lgsm user on the main linux host with the folder /home/lgsm; i use root user of the main linux system to build and use the script + - Download the git repo git clone ... -- Change permission to executable : chmod +x lgsm-build.sh && chmod +x lgsm.sh +- Change permission to executable : chmod +x linuxgsm-docker-build.sh && chmod +x linuxgsm-docker.sh - Execute linuxgsm-docker-build.sh - Edit some variable at the top of the linuxgsm-docker.sh script -- Execute lgsm.sh all you need is in this script +- Execute linuxgsm-docker.sh all you need is in this script ## TODO From c5e439580aa0f3addb637c489b155ffbf11b7aa2 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Tue, 16 Jan 2018 20:40:03 -0500 Subject: [PATCH 36/70] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 00ec950..8ab9e4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,7 +72,7 @@ ENV LC_ALL en_US.UTF-8 ## lgsm.sh RUN wget -N --no-check-certificate https://gameservermanagers.com/dl/linuxgsm.sh -## if you have a permission probleme, check uid gid with the command id of the real machine user lgsm +## if you have a permission probleme, check uid gid with the command id of the main linux user lgsm ## you need to have the same guid and uid as your real machine storage/data folder ## for me, my real user uid is 1001 so i need to create a user for the virtual docker image with the same uid ## user config From 07fcfa6fa8b661265acac9b3238f2cdc9b08fc47 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 08:50:06 -0500 Subject: [PATCH 37/70] add command install --- linuxgsm-docker.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 57bcf2b..bb5637e 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -30,7 +30,7 @@ if [ "$1" != "" ] then cmd=$1 else - echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|attach|command}" + echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|attach|command|install}" read -a cmd fi @@ -77,6 +77,10 @@ case $cmd in "backup") sudo docker exec $InstanceName $ServerType backup ;; + + "install") + sudo docker exec $InstanceName $ServerType install $2 + ;; #"conjob") ## as been tested but need a custom path ... # need to find a way to add this line in crontab of the main linux "* */3 * * * bash ${Path}/linuxgsm-docker.sh command bash check_version.sh >/dev/null 2>&1" From ca49dff7b57a81854c0c8d3abdf2ae2d2febde1b Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 09:28:03 -0500 Subject: [PATCH 38/70] better command option --- linuxgsm-docker.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index bb5637e..ffca39c 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -92,8 +92,8 @@ case $cmd in ;; "command") - # need to find a way to use all parameter after the first one, but work for now ... - sudo docker exec -it $InstanceName $2 $3 $4 $5 + ## Need to be test (take all parameter after the first one) + sudo docker exec -it $InstanceName ${@:2} ;; *) From 422c6b2813c5093eabaeb627b3c6a87cdd9e3566 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 09:56:43 -0500 Subject: [PATCH 39/70] add the case to a function; need to be test --- linuxgsm-docker.sh | 140 +++++++++++++++++++++++---------------------- 1 file changed, 73 insertions(+), 67 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index ffca39c..56c2ad1 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -14,6 +14,77 @@ Path=`pwd` ## check if the container already running (true or '') status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) +fn_command_sender(){ + + case $cmd in + "install") + read -a type + sudo docker exec $InstanceName $ServerType install $type + ;; + + "start") + sudo docker exec $InstanceName $ServerType start + sleep 2 + sudo docker exec $InstanceName alert_discord.sh start + ;; + + "stop") + if [ "$status" == "true" ] + then + sudo docker exec $InstanceName alert_discord.sh stop + sudo docker exec $InstanceName $ServerType stop + sudo docker kill $InstanceName + fi + ;; + + "restart") + sudo docker exec $InstanceName alert_discord.sh restart + sudo docker exec $InstanceName $ServerType restart + ;; + + "console") + sudo docker exec $InstanceName $ServerType console + ;; + + "monitor") + sudo docker exec $InstanceName $ServerType monitor + ;; + + "update") ## update stop the server if is already running(lgsm script). + sudo docker exec $InstanceName alert_discord.sh update + sudo docker exec $InstanceName $ServerType update + ;; + + "backup") + sudo docker exec $InstanceName $ServerType backup + ;; + + "install") + sudo docker exec $InstanceName $ServerType install $2 + ;; + + #"conjob") ## as been tested but need a custom path ... + # need to find a way to add this line in crontab of the main linux "* */3 * * * bash ${Path}/linuxgsm-docker.sh command bash check_version.sh >/dev/null 2>&1" + # ;; + + "attach") + echo "dettach with ctrl+p & ctrl+q" + sudo docker attach $InstanceName + ;; + + "command") + ## Need to be test (take all parameter after the first one) + sudo docker exec -it $InstanceName ${@:2} + ;; + + *) + exit 1 + + esac + +} + + if [ "$status" != "true" ] && [ "$1" != "stop" ] then echo "docker container was not running. start it for you." @@ -29,76 +100,11 @@ fi if [ "$1" != "" ] then cmd=$1 + fn_command_sender $cmd else echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|attach|command|install}" read -a cmd + fn_command_sender $cmd fi - -case $cmd in - "install") - read -a type - sudo docker exec $InstanceName $ServerType install $type - ;; - - "start") - sudo docker exec $InstanceName $ServerType start - sleep 2 - sudo docker exec $InstanceName alert_discord.sh start - ;; - - "stop") - if [ "$status" == "true" ] - then - sudo docker exec $InstanceName alert_discord.sh stop - sudo docker exec $InstanceName $ServerType stop - sudo docker kill $InstanceName - fi - ;; - - "restart") - sudo docker exec $InstanceName alert_discord.sh restart - sudo docker exec $InstanceName $ServerType restart - ;; - - "console") - sudo docker exec $InstanceName $ServerType console - ;; - - "monitor") - sudo docker exec $InstanceName $ServerType monitor - ;; - - "update") ## update stop the server if is already running(lgsm script). - sudo docker exec $InstanceName alert_discord.sh update - sudo docker exec $InstanceName $ServerType update - ;; - - "backup") - sudo docker exec $InstanceName $ServerType backup - ;; - - "install") - sudo docker exec $InstanceName $ServerType install $2 - ;; - - #"conjob") ## as been tested but need a custom path ... - # need to find a way to add this line in crontab of the main linux "* */3 * * * bash ${Path}/linuxgsm-docker.sh command bash check_version.sh >/dev/null 2>&1" - # ;; - - "attach") - echo "dettach with ctrl+p & ctrl+q" - sudo docker attach $InstanceName - ;; - - "command") - ## Need to be test (take all parameter after the first one) - sudo docker exec -it $InstanceName ${@:2} - ;; - - *) - exit 1 - -esac - #sudo docker run --name arkserver --rm -it -d -v "/home/lgsm/:/home/lgsm" lgsm-docker bash $@ From a62c940c88ca225bf0e4de3bf8b2d907603774f8 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 09:58:17 -0500 Subject: [PATCH 40/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 56c2ad1..646a2b6 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -78,8 +78,8 @@ fn_command_sender(){ ;; *) + echo "Parameter invalid, exit." exit 1 - esac } From e1460b739f837525153fdc963e55eee3f8fabd37 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 10:03:05 -0500 Subject: [PATCH 41/70] change a condition to something better --- linuxgsm-docker.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 646a2b6..e46f2ce 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -97,7 +97,8 @@ else echo "docker container not running." fi -if [ "$1" != "" ] +## check if we have a parameter +if [ "${#}" > 0 ] then cmd=$1 fn_command_sender $cmd From 47a764f7a42abfd7ca7013455ed250e40a2d20fa Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 13:44:58 -0500 Subject: [PATCH 42/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index e46f2ce..249916e 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -10,6 +10,10 @@ ServerType='arkserver' Img='lgsm-docker' ## current path; plz execute this script from it folder Path=`pwd` +## Set the Network Used by docker +network='host' +## Set the hostname for the docker container +hostname='LGSM' ## check if the container already running (true or '') status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) @@ -59,10 +63,6 @@ fn_command_sender(){ sudo docker exec $InstanceName $ServerType backup ;; - "install") - sudo docker exec $InstanceName $ServerType install $2 - ;; - #"conjob") ## as been tested but need a custom path ... # need to find a way to add this line in crontab of the main linux "* */3 * * * bash ${Path}/linuxgsm-docker.sh command bash check_version.sh >/dev/null 2>&1" # ;; @@ -89,7 +89,7 @@ if [ "$status" != "true" ] && [ "$1" != "stop" ] then echo "docker container was not running. start it for you." sudo docker rm $InstanceName 2> /dev/null - sudo docker run --name $InstanceName --restart always --net=host --hostname LGSM -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null + sudo docker run --name $InstanceName --restart always --net=${network} --hostname ${hostname} -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null elif [ "$status" == "true" ] then echo "docker container already running, append command." From 7724626bed65df0501204ae98184fbe7ee455865 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 13:56:57 -0500 Subject: [PATCH 43/70] add command validate --- linuxgsm-docker.sh | 135 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 2 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 249916e..6f6e4d4 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -22,8 +22,14 @@ fn_command_sender(){ case $cmd in "install") - read -a type - sudo docker exec $InstanceName $ServerType install $type + if[ $2 != "" ] + then + read -a type + sudo docker exec $InstanceName $ServerType install $type + else + echo "Missing parameter for the serveur name to install" + sudo docker exec $InstanceName $ServerType install + fi ;; "start") @@ -58,6 +64,131 @@ fn_command_sender(){ sudo docker exec $InstanceName alert_discord.sh update sudo docker exec $InstanceName $ServerType update ;; + + "validate") + sudo docker exec $InstanceName $ServerType validate + ;; + + "backup") + sudo docker exec $InstanceName $ServerType backup + ;; + + #"conjob") ## as been tested but need a custom path ... + # need to find a way to add this line in crontab of the main linux "* */3 * * * bash ${Path}/linuxgsm-docker.sh command bash check_version.sh >/dev/null 2>&1" + # ;; + + "attach") + echo "dettach with ctrl+p & ctrl+q" + sudo docker attach $InstanceName + ;; + + "command") + ## Need to be test (take all parameter after the first one) + sudo docker exec -it $InstanceName ${@:2} + ;; + + *) + echo "Parameter invalid, exit." + exit 1 + esac + +} + + +if [ "$status" != "true" ] && [ "$1" != "stop" ] +then + echo "docker container was not running. start it for you." + sudo docker rm $InstanceName 2> /dev/null + sudo docker run --name $InstanceName --restart always --net=${network} --hostname ${hostname} -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null +elif [ "$status" == "true" ] +then + echo "docker container already running, append command." +else + echo "docker container not running." +fi + +## check if we have a parameter +if [ "${#}" > 0 ] +then + cmd=$1 + fn_command_sender $cmd +else + echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|attach|command|install}" + read -a cmd + fn_command_sender $cmd +fi + +#sudo docker run --name arkserver --rm -it -d -v "/home/lgsm/:/home/lgsm" lgsm-docker bash $@ +#!/bin/bash + +## can be simplified. + +## name of the docker process +InstanceName='arkserver' +## arkserver for me (it's the script name in the serveur directory) +ServerType='arkserver' +## Image name to run (i have build with the lgsm-build.sh) +Img='lgsm-docker' +## current path; plz execute this script from it folder +Path=`pwd` +## Set the Network Used by docker +network='host' +## Set the hostname for the docker container +hostname='LGSM' + +## check if the container already running (true or '') +status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) + +fn_command_sender(){ + + case $cmd in + "install") + if[ $2 != "" ] + then + read -a type + sudo docker exec $InstanceName $ServerType install $type + else + echo "Missing parameter for the serveur name to install" + sudo docker exec $InstanceName $ServerType install + fi + ;; + + "start") + sudo docker exec $InstanceName $ServerType start + sleep 2 + sudo docker exec $InstanceName alert_discord.sh start + ;; + + "stop") + if [ "$status" == "true" ] + then + sudo docker exec $InstanceName alert_discord.sh stop + sudo docker exec $InstanceName $ServerType stop + sudo docker kill $InstanceName + fi + ;; + + "restart") + sudo docker exec $InstanceName alert_discord.sh restart + sudo docker exec $InstanceName $ServerType restart + ;; + + "console") + sudo docker exec $InstanceName $ServerType console + ;; + + "monitor") + sudo docker exec $InstanceName $ServerType monitor + ;; + + "update") ## update stop the server if is already running(lgsm script). + sudo docker exec $InstanceName alert_discord.sh update + sudo docker exec $InstanceName $ServerType update + ;; + + "validate") + sudo docker exec $InstanceName $ServerType validate + ;; "backup") sudo docker exec $InstanceName $ServerType backup From 45f6e2d01bb23c6a913431aa3cce0e4337661100 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 14:03:15 -0500 Subject: [PATCH 44/70] remove forget duplication my bad --- linuxgsm-docker.sh | 128 ++------------------------------------------- 1 file changed, 5 insertions(+), 123 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 6f6e4d4..a54c67e 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -73,131 +73,13 @@ fn_command_sender(){ sudo docker exec $InstanceName $ServerType backup ;; - #"conjob") ## as been tested but need a custom path ... - # need to find a way to add this line in crontab of the main linux "* */3 * * * bash ${Path}/linuxgsm-docker.sh command bash check_version.sh >/dev/null 2>&1" - # ;; - - "attach") - echo "dettach with ctrl+p & ctrl+q" - sudo docker attach $InstanceName + "conjob") + crontab -l > CronTemp + echo "* */3 * * * bash ${Path}/linuxgsm-docker.sh command bash check_version.sh >/dev/null 2>&1" >> CronTemp + crontab CronTemp + rm CronTemp ;; - "command") - ## Need to be test (take all parameter after the first one) - sudo docker exec -it $InstanceName ${@:2} - ;; - - *) - echo "Parameter invalid, exit." - exit 1 - esac - -} - - -if [ "$status" != "true" ] && [ "$1" != "stop" ] -then - echo "docker container was not running. start it for you." - sudo docker rm $InstanceName 2> /dev/null - sudo docker run --name $InstanceName --restart always --net=${network} --hostname ${hostname} -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null -elif [ "$status" == "true" ] -then - echo "docker container already running, append command." -else - echo "docker container not running." -fi - -## check if we have a parameter -if [ "${#}" > 0 ] -then - cmd=$1 - fn_command_sender $cmd -else - echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|attach|command|install}" - read -a cmd - fn_command_sender $cmd -fi - -#sudo docker run --name arkserver --rm -it -d -v "/home/lgsm/:/home/lgsm" lgsm-docker bash $@ -#!/bin/bash - -## can be simplified. - -## name of the docker process -InstanceName='arkserver' -## arkserver for me (it's the script name in the serveur directory) -ServerType='arkserver' -## Image name to run (i have build with the lgsm-build.sh) -Img='lgsm-docker' -## current path; plz execute this script from it folder -Path=`pwd` -## Set the Network Used by docker -network='host' -## Set the hostname for the docker container -hostname='LGSM' - -## check if the container already running (true or '') -status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) - -fn_command_sender(){ - - case $cmd in - "install") - if[ $2 != "" ] - then - read -a type - sudo docker exec $InstanceName $ServerType install $type - else - echo "Missing parameter for the serveur name to install" - sudo docker exec $InstanceName $ServerType install - fi - ;; - - "start") - sudo docker exec $InstanceName $ServerType start - sleep 2 - sudo docker exec $InstanceName alert_discord.sh start - ;; - - "stop") - if [ "$status" == "true" ] - then - sudo docker exec $InstanceName alert_discord.sh stop - sudo docker exec $InstanceName $ServerType stop - sudo docker kill $InstanceName - fi - ;; - - "restart") - sudo docker exec $InstanceName alert_discord.sh restart - sudo docker exec $InstanceName $ServerType restart - ;; - - "console") - sudo docker exec $InstanceName $ServerType console - ;; - - "monitor") - sudo docker exec $InstanceName $ServerType monitor - ;; - - "update") ## update stop the server if is already running(lgsm script). - sudo docker exec $InstanceName alert_discord.sh update - sudo docker exec $InstanceName $ServerType update - ;; - - "validate") - sudo docker exec $InstanceName $ServerType validate - ;; - - "backup") - sudo docker exec $InstanceName $ServerType backup - ;; - - #"conjob") ## as been tested but need a custom path ... - # need to find a way to add this line in crontab of the main linux "* */3 * * * bash ${Path}/linuxgsm-docker.sh command bash check_version.sh >/dev/null 2>&1" - # ;; - "attach") echo "dettach with ctrl+p & ctrl+q" sudo docker attach $InstanceName From 6685f9348d506ed9e46e8df5bc6ef580c564cf07 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 14:08:59 -0500 Subject: [PATCH 45/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index a54c67e..2504ba5 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -14,10 +14,18 @@ Path=`pwd` network='host' ## Set the hostname for the docker container hostname='LGSM' +## Set it to False if you don't have a discord custom script like me +enable="True" ## check if the container already running (true or '') status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) +fn_discord_custom_sender(){ + + + +} + fn_command_sender(){ case $cmd in From c9f8002deda520494833116d4ebb6f7e3c778945 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 14:19:21 -0500 Subject: [PATCH 46/70] better Shell setup ... cleaning --- linuxgsm-docker.sh | 67 ++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 2504ba5..2252a23 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -11,18 +11,22 @@ Img='lgsm-docker' ## current path; plz execute this script from it folder Path=`pwd` ## Set the Network Used by docker -network='host' +Network='host' ## Set the hostname for the docker container -hostname='LGSM' +Hostname='LGSM' ## Set it to False if you don't have a discord custom script like me -enable="True" +DiscordNotifier="True" ## check if the container already running (true or '') status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) fn_discord_custom_sender(){ - + if [ "${DiscordNotifier}" == "true" ] + then + sleep 2 + sudo docker exec ${InstanceName} alert_discord.sh ${cmd} + fi } @@ -33,52 +37,51 @@ fn_command_sender(){ if[ $2 != "" ] then read -a type - sudo docker exec $InstanceName $ServerType install $type + sudo docker exec ${InstanceName} ${ServerType} install ${type} else - echo "Missing parameter for the serveur name to install" - sudo docker exec $InstanceName $ServerType install + echo "Missing parameter for the serveur name to install, showing server game list" + sudo docker exec ${InstanceName} ${ServerType} install fi ;; "start") - sudo docker exec $InstanceName $ServerType start - sleep 2 - sudo docker exec $InstanceName alert_discord.sh start + sudo docker exec ${InstanceName} ${ServerType} start + fn_discord_custom_sender ${cmd} ;; "stop") if [ "$status" == "true" ] then - sudo docker exec $InstanceName alert_discord.sh stop - sudo docker exec $InstanceName $ServerType stop - sudo docker kill $InstanceName + sudo docker exec ${InstanceName} ${ServerType} stop + fn_discord_custom_sender ${cmd} + sudo docker kill ${InstanceName} fi ;; "restart") - sudo docker exec $InstanceName alert_discord.sh restart - sudo docker exec $InstanceName $ServerType restart + sudo docker exec ${InstanceName} ${ServerType} restart + fn_discord_custom_sender ${cmd} + ;; + + "update") ## update stop the server if is already running(lgsm script). + sudo docker exec ${InstanceName} ${ServerType} update + fn_discord_custom_sender ${cmd} ;; "console") - sudo docker exec $InstanceName $ServerType console + sudo docker exec ${InstanceName} ${ServerType} console ;; "monitor") - sudo docker exec $InstanceName $ServerType monitor - ;; - - "update") ## update stop the server if is already running(lgsm script). - sudo docker exec $InstanceName alert_discord.sh update - sudo docker exec $InstanceName $ServerType update + sudo docker exec ${InstanceName} ${ServerType} monitor ;; "validate") - sudo docker exec $InstanceName $ServerType validate + sudo docker exec ${InstanceName} ${ServerType} validate ;; "backup") - sudo docker exec $InstanceName $ServerType backup + sudo docker exec ${InstanceName} ${ServerType} backup ;; "conjob") @@ -90,12 +93,12 @@ fn_command_sender(){ "attach") echo "dettach with ctrl+p & ctrl+q" - sudo docker attach $InstanceName + sudo docker attach ${InstanceName} ;; "command") ## Need to be test (take all parameter after the first one) - sudo docker exec -it $InstanceName ${@:2} + sudo docker exec -it ${InstanceName} ${@:2} ;; *) @@ -106,12 +109,12 @@ fn_command_sender(){ } -if [ "$status" != "true" ] && [ "$1" != "stop" ] +if [ "${status}" != "true" ] && [ "$1" != "stop" ] then echo "docker container was not running. start it for you." - sudo docker rm $InstanceName 2> /dev/null - sudo docker run --name $InstanceName --restart always --net=${network} --hostname ${hostname} -it -d -v "/home/lgsm/:/home/lgsm" $Img bash 2> /dev/null -elif [ "$status" == "true" ] + sudo docker rm ${InstanceName} 2> /dev/null + sudo docker run --name ${InstanceName} --restart always --net=${Network} --hostname ${Hostname} -it -d -v "/home/lgsm/:/home/lgsm" ${Img} bash 2> /dev/null +elif [ "${status}" == "true" ] then echo "docker container already running, append command." else @@ -122,11 +125,11 @@ fi if [ "${#}" > 0 ] then cmd=$1 - fn_command_sender $cmd + fn_command_sender ${cmd} else echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|attach|command|install}" read -a cmd - fn_command_sender $cmd + fn_command_sender ${cmd} fi #sudo docker run --name arkserver --rm -it -d -v "/home/lgsm/:/home/lgsm" lgsm-docker bash $@ From a6220c7c3cfad913ba20d9398c48d59fa780cf75 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 14:23:38 -0500 Subject: [PATCH 47/70] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index c63296a..eddda89 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,4 @@ PS: you need to have a lgsm user on the main linux host with the folder /home/lg ## TODO -- Install script to edit variable in script automaticaly -- Multi-lgsm server type on one lgsm install -- Support all server type depency and default port in a function bash +- Multi-lgsm server type support on one lgsm install From d83da2a3e021848ceb2344987ab8ad8080529f2c Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 18 Jan 2018 14:29:38 -0500 Subject: [PATCH 48/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 2252a23..21bfc65 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -30,7 +30,11 @@ fn_discord_custom_sender(){ } -fn_command_sender(){ +fn_cmd_sender() { + +} + +fn_command_support(){ case $cmd in "install") @@ -83,6 +87,14 @@ fn_command_sender(){ "backup") sudo docker exec ${InstanceName} ${ServerType} backup ;; + + "details") + sudo docker exec ${InstanceName} ${ServerType} details + ;; + + "alerts") + sudo docker exec ${InstanceName} ${ServerType} alerts + ;; "conjob") crontab -l > CronTemp @@ -125,11 +137,11 @@ fi if [ "${#}" > 0 ] then cmd=$1 - fn_command_sender ${cmd} + fn_command_support ${cmd} else - echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|attach|command|install}" + echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|details|alerts|cronjob|attach|command|install}" read -a cmd - fn_command_sender ${cmd} + fn_command_support ${cmd} fi #sudo docker run --name arkserver --rm -it -d -v "/home/lgsm/:/home/lgsm" lgsm-docker bash $@ From 3901f807c34b3d21e3e56c340b72f641fbde82fa Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Fri, 19 Jan 2018 09:09:21 -0500 Subject: [PATCH 49/70] use a new function to stop duplication --- linuxgsm-docker.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 21bfc65..676967e 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -30,8 +30,9 @@ fn_discord_custom_sender(){ } -fn_cmd_sender() { - +## need to be test +fn_exec_cmd_sender() { + sudo docker exec ${InstanceName} ${ServerType} ${cmd} } fn_command_support(){ @@ -49,21 +50,21 @@ fn_command_support(){ ;; "start") - sudo docker exec ${InstanceName} ${ServerType} start + fn_exec_cmd_sender start fn_discord_custom_sender ${cmd} ;; "stop") if [ "$status" == "true" ] then - sudo docker exec ${InstanceName} ${ServerType} stop + fn_exec_cmd_sender stop fn_discord_custom_sender ${cmd} sudo docker kill ${InstanceName} fi ;; "restart") - sudo docker exec ${InstanceName} ${ServerType} restart + fn_exec_cmd_sender restart fn_discord_custom_sender ${cmd} ;; @@ -73,27 +74,27 @@ fn_command_support(){ ;; "console") - sudo docker exec ${InstanceName} ${ServerType} console + fn_exec_cmd_sender console ;; "monitor") - sudo docker exec ${InstanceName} ${ServerType} monitor + fn_exec_cmd_sender monitor ;; "validate") - sudo docker exec ${InstanceName} ${ServerType} validate + fn_exec_cmd_sender validate ;; "backup") - sudo docker exec ${InstanceName} ${ServerType} backup + fn_exec_cmd_sender backup ;; "details") - sudo docker exec ${InstanceName} ${ServerType} details + fn_exec_cmd_sender details ;; "alerts") - sudo docker exec ${InstanceName} ${ServerType} alerts + fn_exec_cmd_sender alerts ;; "conjob") From 185c5e45cf40c9b8fc2f01ee427878bde4ffc406 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Fri, 19 Jan 2018 09:13:25 -0500 Subject: [PATCH 50/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 676967e..fd8e49f 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -32,7 +32,7 @@ fn_discord_custom_sender(){ ## need to be test fn_exec_cmd_sender() { - sudo docker exec ${InstanceName} ${ServerType} ${cmd} + sudo docker exec ${InstanceName} ${ServerType} ${1} } fn_command_support(){ From f1caa9519bd005c6c94c4a6769f8d3e177cb2d5e Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Fri, 19 Jan 2018 09:13:52 -0500 Subject: [PATCH 51/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index fd8e49f..b3bc34c 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -31,7 +31,7 @@ fn_discord_custom_sender(){ } ## need to be test -fn_exec_cmd_sender() { +fn_exec_cmd_sender(){ sudo docker exec ${InstanceName} ${ServerType} ${1} } From a2e21bfd1472195840d1d695722c9a516523a9c0 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Fri, 19 Jan 2018 09:26:08 -0500 Subject: [PATCH 52/70] update function for more parameters --- linuxgsm-docker.sh | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index b3bc34c..e2fdac1 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -32,69 +32,74 @@ fn_discord_custom_sender(){ ## need to be test fn_exec_cmd_sender(){ - sudo docker exec ${InstanceName} ${ServerType} ${1} + if [ ${1} == "exec" ] + then + sudo docker ${1} ${InstanceName} ${ServerType} ${2} ${3} + else + sudo docker ${1} ${InstanceName} + fi } fn_command_support(){ case $cmd in "install") - if[ $2 != "" ] + if [ $2 != "" ] then read -a type - sudo docker exec ${InstanceName} ${ServerType} install ${type} + fn_exec_cmd_sender exec install ${type} else echo "Missing parameter for the serveur name to install, showing server game list" - sudo docker exec ${InstanceName} ${ServerType} install + fn_exec_cmd_sender exec install fi ;; "start") - fn_exec_cmd_sender start + fn_exec_cmd_sender exec start fn_discord_custom_sender ${cmd} ;; "stop") if [ "$status" == "true" ] then - fn_exec_cmd_sender stop + fn_exec_cmd_sender exec stop fn_discord_custom_sender ${cmd} sudo docker kill ${InstanceName} fi ;; "restart") - fn_exec_cmd_sender restart + fn_exec_cmd_sender exec restart fn_discord_custom_sender ${cmd} ;; "update") ## update stop the server if is already running(lgsm script). - sudo docker exec ${InstanceName} ${ServerType} update + fn_exec_cmd_sender exec update fn_discord_custom_sender ${cmd} ;; "console") - fn_exec_cmd_sender console + fn_exec_cmd_sender exec console ;; "monitor") - fn_exec_cmd_sender monitor + fn_exec_cmd_sender exec monitor ;; "validate") - fn_exec_cmd_sender validate + fn_exec_cmd_sender exec validate ;; "backup") - fn_exec_cmd_sender backup + fn_exec_cmd_sender exec backup ;; "details") - fn_exec_cmd_sender details + fn_exec_cmd_sender exec details ;; "alerts") - fn_exec_cmd_sender alerts + fn_exec_cmd_sender exec alerts ;; "conjob") @@ -106,7 +111,7 @@ fn_command_support(){ "attach") echo "dettach with ctrl+p & ctrl+q" - sudo docker attach ${InstanceName} + fn_exec_cmd_sender attach ;; "command") From 1a77a283c928d880882d5eed012f7e2edc532c84 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 10:41:45 -0500 Subject: [PATCH 53/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index e2fdac1..c3a6451 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -8,7 +8,7 @@ InstanceName='arkserver' ServerType='arkserver' ## Image name to run (i have build with the lgsm-build.sh) Img='lgsm-docker' -## current path; plz execute this script from it folder +## current path; plz execute this script from it's folder Path=`pwd` ## Set the Network Used by docker Network='host' From fb15252564baa92f02456266a5e4d8e53d74a252 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 10:52:59 -0500 Subject: [PATCH 54/70] Update README.md --- README.md | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index eddda89..ed35363 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,19 @@ Dockerhub https://hub.docker.com/r/akshmakov/linuxgsm/ Run Game Servers in Docker, multiplex multiple LinuxGSM deployments easily by taking advantage of Dockers port mapping. +## Easy step + +the script create a user name lgsm with a home directory path /home/lgsm/ + +PS: I use root user of the main linux system to build and use the script + +- Download the git repo git clone ... +- Change permission to executable : chmod +x linuxgsm-docker-build.sh && chmod +x linuxgsm-docker.sh +- Execute linuxgsm-docker-build.sh +- Edit some variable at the top of the linuxgsm-docker.sh script +- Execute linuxgsm-docker.sh all you need is in this script + + ## Image Tags - `latest` `base` - base image with linuxgsm.sh script and user setup @@ -164,7 +177,7 @@ $ docker-compose stop q2server ## Container Overview -`linuxgsm.sh` script is particularly picky about paths and does things a little different from a typical daemon. +`linuxgsm-docker.sh` script is particularly picky about paths and does things a little different from a typical daemon. In particular this docker images seeks to encapsulate LinuxGSM exactly as it is, to allow for easy transition from non-docker based deployments @@ -176,20 +189,4 @@ These quirks are - Script runs server in a tmux session (Difficult to attach to output) -This Container runs `linuxgsm.sh` under a generic user `lgsm` and script and server data installed under the home directory `/home/lgsm` - -## Easy step - -the script create a user name lgsm app path is /home/lgsm/ - -PS: you need to have a lgsm user on the main linux host with the folder /home/lgsm; i use root user of the main linux system to build and use the script - -- Download the git repo git clone ... -- Change permission to executable : chmod +x linuxgsm-docker-build.sh && chmod +x linuxgsm-docker.sh -- Execute linuxgsm-docker-build.sh -- Edit some variable at the top of the linuxgsm-docker.sh script -- Execute linuxgsm-docker.sh all you need is in this script - -## TODO - -- Multi-lgsm server type support on one lgsm install +This Container runs `linuxgsm-docker.sh` under a generic user `lgsm` and script and server data installed under the home directory `/home/lgsm` From 346b7d9444ce3de2b7b285c94e7232ea28ec097e Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 10:59:16 -0500 Subject: [PATCH 55/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index c3a6451..c0b3611 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -17,17 +17,15 @@ Hostname='LGSM' ## Set it to False if you don't have a discord custom script like me DiscordNotifier="True" -## check if the container already running (true or '') +## check if the container already running; return (true or '') status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) fn_discord_custom_sender(){ - if [ "${DiscordNotifier}" == "true" ] then sleep 2 sudo docker exec ${InstanceName} alert_discord.sh ${cmd} fi - } ## need to be test @@ -127,6 +125,7 @@ fn_command_support(){ } +## check if the the container already running; if not start it if command is not Stop; if [ "${status}" != "true" ] && [ "$1" != "stop" ] then echo "docker container was not running. start it for you." From c641d6a3b52ab5a41d2ea16ea531c1740f5103ea Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 11:09:10 -0500 Subject: [PATCH 56/70] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index ed35363..8ca5624 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,13 @@ PS: I use root user of the main linux system to build and use the script - Download the git repo git clone ... - Change permission to executable : chmod +x linuxgsm-docker-build.sh && chmod +x linuxgsm-docker.sh +- Edit DockerFile and open the proper Ports for the server type you want to install (default is for ARK server) - Execute linuxgsm-docker-build.sh - Edit some variable at the top of the linuxgsm-docker.sh script - Execute linuxgsm-docker.sh all you need is in this script +if you want to edit server config from main linux system you need to have lgsm user as the same uid than in docker for the user or the owner ship going to be diffrent in container and the main linux system get permission issue or need to chown it but you can't do that from the main linux system because the user for the chown is a other os... + ## Image Tags From 97f1f4b6c3feec75265bf69826756cf66689f70a Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 11:27:53 -0500 Subject: [PATCH 57/70] Update Dockerfile Update Dockerfile Update Dockerfile Update Dockerfile Update Dockerfile Update Dockerfile --- Dockerfile | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8ab9e4d..39aab11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,13 +6,26 @@ LABEL maintainer="jkljkl1197 on github" ENV DEBIAN_FRONTEND noninteractive ## Ports Use can use -p port:port also -EXPOSE 27015:27015 7777:7777 7778:7778 27020:27020 443:443 80:80 \ - 27015:27015/udp 7777:7777/udp 7778:7778/udp 27020:27020/udp 443:443/udp 80:80/udp +#I open bolth tcp and udp but udp in not all time necessary. +#Line 1 commun ports steam tcp +#Line 2 commun ports steam udp +#Line 3 Rcon and Web port for some server update agent tcp +#Line 4 Rcon and Web port for some server update agent udp +EXPOSE 27015:27015 7777:7777 7778:7778 \ + 27015:27015/udp 7777:7777/udp 7778:7778/udp \ + 27020:27020 443:443 80:80 \ + 27020:27020/udp 443:443/udp 80:80/udp -## Base System +## Base System package +# install apt-utils before because some installer deb script need it RUN dpkg --add-architecture i386 && \ apt-get update -y && \ apt-get install -y --no-install-recommends apt-utils +## Tools (Optional) +#add packet you want to add here. + apt-get install - y \ + nano \ + net-tools ## Dependency RUN apt-get install -y \ binutils \ @@ -55,21 +68,19 @@ RUN apt-get install -y \ libgtk2.0-0:i386 \ libdbus-glib-1-2:i386 \ libnm-glib-dev:i386 \ - cron \ procps \ - locales \ - nano \ - net-tools + locales \ + cron ENV LGSM_DOCKER_VERSION 17.11.0 -## UTF-8 Probleme ... +## UTF-8 Probleme tmux... RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 -## lgsm.sh +## linuxgsm.sh RUN wget -N --no-check-certificate https://gameservermanagers.com/dl/linuxgsm.sh ## if you have a permission probleme, check uid gid with the command id of the main linux user lgsm @@ -80,7 +91,7 @@ RUN adduser --disabled-password --gecos "" --uid 1001 lgsm && \ chown lgsm:lgsm /linuxgsm.sh && \ chmod +x /linuxgsm.sh && \ cp /linuxgsm.sh /home/lgsm/linuxgsm.sh && \ - usermod -G tty lgsm #solve ark script error + usermod -G tty lgsm #solve tmux script error USER lgsm WORKDIR /home/lgsm From b4c03d209b404f5aee95865725cb42fc06fbc317 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 11:44:07 -0500 Subject: [PATCH 58/70] Update README.md Update README.md Update README.md Update README.md Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8ca5624..611c95f 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ Run Game Servers in Docker, multiplex multiple LinuxGSM deployments easily by ta ## Easy step -the script create a user name lgsm with a home directory path /home/lgsm/ +The script create a user name lgsm with a home directory path /home/lgsm/ -PS: I use root user of the main linux system to build and use the script +Use root user of the main linux system to build and use the script - Download the git repo git clone ... - Change permission to executable : chmod +x linuxgsm-docker-build.sh && chmod +x linuxgsm-docker.sh -- Edit DockerFile and open the proper Ports for the server type you want to install (default is for ARK server) +- Edit DockerFile and open the proper Ports for the server type you want to install(default steam base 777[7-8], 2015...) - Execute linuxgsm-docker-build.sh - Edit some variable at the top of the linuxgsm-docker.sh script - Execute linuxgsm-docker.sh all you need is in this script From caeda776b048a8d05142ab6a2274c2d1f577d226 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 11:59:53 -0500 Subject: [PATCH 59/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index c0b3611..82e331a 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -2,9 +2,10 @@ ## can be simplified. -## name of the docker process +## name of the docker container InstanceName='arkserver' ## arkserver for me (it's the script name in the serveur directory) +# for you need to be 'linuxgsm.sh' ServerType='arkserver' ## Image name to run (i have build with the lgsm-build.sh) Img='lgsm-docker' From ab48ecfd9aaf98d9360a9ca385a18dda060962e9 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 12:02:23 -0500 Subject: [PATCH 60/70] Update README.md Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 611c95f..50810cd 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,11 @@ Use root user of the main linux system to build and use the script - Edit some variable at the top of the linuxgsm-docker.sh script - Execute linuxgsm-docker.sh all you need is in this script -if you want to edit server config from main linux system you need to have lgsm user as the same uid than in docker for the user or the owner ship going to be diffrent in container and the main linux system get permission issue or need to chown it but you can't do that from the main linux system because the user for the chown is a other os... +if you want to edit server config from main linux system you need to have lgsm user as the same uid than in docker for the user or the owner ship going to be diffrent in container and the main linux system get permission issue or need to chown it but you can't do that from the main linux system because the user for the chown is on a other os... +### After this line the documentation is out updated but most of it is usefull + ## Image Tags - `latest` `base` - base image with linuxgsm.sh script and user setup From 7396e7f4a983b0ee60ac61c17fd9ee636d7a46a6 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 13:41:54 -0500 Subject: [PATCH 61/70] Update Dockerfile Update Dockerfile Update Dockerfile Update Dockerfile Update Dockerfile --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 39aab11..30ac3d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,10 +20,11 @@ EXPOSE 27015:27015 7777:7777 7778:7778 \ # install apt-utils before because some installer deb script need it RUN dpkg --add-architecture i386 && \ apt-get update -y && \ + apt-get upgrade -y && \ apt-get install -y --no-install-recommends apt-utils ## Tools (Optional) #add packet you want to add here. - apt-get install - y \ +RUN apt-get install -y \ nano \ net-tools ## Dependency @@ -68,6 +69,8 @@ RUN apt-get install -y \ libgtk2.0-0:i386 \ libdbus-glib-1-2:i386 \ libnm-glib-dev:i386 \ + apt-transport-https \ + ca-certificates \ procps \ locales \ cron From 14227267ab83e1fcbf1564cc2692cbcd31ccb206 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 18:05:13 -0500 Subject: [PATCH 62/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 82e331a..98a7c64 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -43,7 +43,7 @@ fn_command_support(){ case $cmd in "install") - if [ $2 != "" ] + if [ "${2}" != "" ] then read -a type fn_exec_cmd_sender exec install ${type} From 4da02b737773b7442db6581059cc787081c5fa2a Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 18:10:42 -0500 Subject: [PATCH 63/70] repair some stuff --- linuxgsm-docker.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 98a7c64..4c2a809 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -10,7 +10,7 @@ ServerType='arkserver' ## Image name to run (i have build with the lgsm-build.sh) Img='lgsm-docker' ## current path; plz execute this script from it's folder -Path=`pwd` +Path=$(pwd) ## Set the Network Used by docker Network='host' ## Set the hostname for the docker container @@ -25,17 +25,17 @@ fn_discord_custom_sender(){ if [ "${DiscordNotifier}" == "true" ] then sleep 2 - sudo docker exec ${InstanceName} alert_discord.sh ${cmd} + sudo docker exec ${InstanceName} alert_discord.sh "${cmd}" fi } ## need to be test fn_exec_cmd_sender(){ - if [ ${1} == "exec" ] + if [ "${1}" == "exec" ] then - sudo docker ${1} ${InstanceName} ${ServerType} ${2} ${3} + sudo docker "${1}" ${InstanceName} ${ServerType} "${2}" "${3}" else - sudo docker ${1} ${InstanceName} + sudo docker "${1}" ${InstanceName} fi } @@ -45,8 +45,8 @@ fn_command_support(){ "install") if [ "${2}" != "" ] then - read -a type - fn_exec_cmd_sender exec install ${type} + read -ar type + fn_exec_cmd_sender exec install "${type}" else echo "Missing parameter for the serveur name to install, showing server game list" fn_exec_cmd_sender exec install @@ -55,26 +55,26 @@ fn_command_support(){ "start") fn_exec_cmd_sender exec start - fn_discord_custom_sender ${cmd} + fn_discord_custom_sender "${cmd}" ;; "stop") if [ "$status" == "true" ] then fn_exec_cmd_sender exec stop - fn_discord_custom_sender ${cmd} + fn_discord_custom_sender "${cmd}" sudo docker kill ${InstanceName} fi ;; "restart") fn_exec_cmd_sender exec restart - fn_discord_custom_sender ${cmd} + fn_discord_custom_sender "${cmd}" ;; "update") ## update stop the server if is already running(lgsm script). fn_exec_cmd_sender exec update - fn_discord_custom_sender ${cmd} + fn_discord_custom_sender "${cmd}" ;; "console") @@ -115,7 +115,7 @@ fn_command_support(){ "command") ## Need to be test (take all parameter after the first one) - sudo docker exec -it ${InstanceName} ${@:2} + sudo docker exec -it ${InstanceName} "${@:2}" ;; *) @@ -140,14 +140,14 @@ else fi ## check if we have a parameter -if [ "${#}" > 0 ] +if [ "${#}" > "0" ] then cmd=$1 - fn_command_support ${cmd} + fn_command_support "${cmd}" else echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|details|alerts|cronjob|attach|command|install}" read -a cmd - fn_command_support ${cmd} + fn_command_support "${cmd}" fi #sudo docker run --name arkserver --rm -it -d -v "/home/lgsm/:/home/lgsm" lgsm-docker bash $@ From a511321e842f9686b828e8816bd772846ffb0ca2 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 18:11:57 -0500 Subject: [PATCH 64/70] Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 4c2a809..87046e1 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -5,7 +5,7 @@ ## name of the docker container InstanceName='arkserver' ## arkserver for me (it's the script name in the serveur directory) -# for you need to be 'linuxgsm.sh' +# for you need to be the server type name of the lgsm script ServerType='arkserver' ## Image name to run (i have build with the lgsm-build.sh) Img='lgsm-docker' @@ -16,7 +16,7 @@ Network='host' ## Set the hostname for the docker container Hostname='LGSM' ## Set it to False if you don't have a discord custom script like me -DiscordNotifier="True" +DiscordNotifier="False" ## check if the container already running; return (true or '') status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) @@ -33,7 +33,12 @@ fn_discord_custom_sender(){ fn_exec_cmd_sender(){ if [ "${1}" == "exec" ] then - sudo docker "${1}" ${InstanceName} ${ServerType} "${2}" "${3}" + if [ "${2}" == "install" ] + then + sudo docker "${1}" ${InstanceName} linuxgsm.sh "${2}" "${3}" + else + sudo docker "${1}" ${InstanceName} ${ServerType} "${2}" "${3}" + fi else sudo docker "${1}" ${InstanceName} fi @@ -41,15 +46,17 @@ fn_exec_cmd_sender(){ fn_command_support(){ - case $cmd in + case ${cmd} in "install") if [ "${2}" != "" ] then - read -ar type - fn_exec_cmd_sender exec install "${type}" + fn_exec_cmd_sender exec install "${2}" else echo "Missing parameter for the serveur name to install, showing server game list" fn_exec_cmd_sender exec install + #echo "enter the server name; ctrl+c to cancel" + #read -ar type + #fn_exec_cmd_sender exec install "${type}" fi ;; @@ -140,14 +147,14 @@ else fi ## check if we have a parameter -if [ "${#}" > "0" ] +if [ "${#}" -gt 0 ] then - cmd=$1 - fn_command_support "${cmd}" + cmd=${1} + fn_command_support "${cmd}" "${2}" else echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|details|alerts|cronjob|attach|command|install}" - read -a cmd - fn_command_support "${cmd}" + read -ar cmd + fn_command_support "${cmd}" "${2}" fi #sudo docker run --name arkserver --rm -it -d -v "/home/lgsm/:/home/lgsm" lgsm-docker bash $@ From 0854613171dfb09c52092326bbf2450336deba15 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 21:05:44 -0500 Subject: [PATCH 65/70] Update Dockerfile Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 30ac3d8..16071fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM debian:stable ENV LGSM_DOCKER_IMAGE LinuxGameServerManager LABEL maintainer="jkljkl1197 on github" -ENV DEBIAN_FRONTEND noninteractive +ARG DEBIAN_FRONTEND="noninteractive" ## Ports Use can use -p port:port also #I open bolth tcp and udp but udp in not all time necessary. From a61b6d2a888b6527b9140448626fc186c5d62b62 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 21:14:50 -0500 Subject: [PATCH 66/70] Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 87046e1..b72393f 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -35,7 +35,7 @@ fn_exec_cmd_sender(){ then if [ "${2}" == "install" ] then - sudo docker "${1}" ${InstanceName} linuxgsm.sh "${2}" "${3}" + sudo docker "${1}" ${InstanceName} bash /home/lgsm/linuxgsm.sh auto-install "${3}" else sudo docker "${1}" ${InstanceName} ${ServerType} "${2}" "${3}" fi @@ -48,16 +48,10 @@ fn_command_support(){ case ${cmd} in "install") - if [ "${2}" != "" ] - then - fn_exec_cmd_sender exec install "${2}" - else - echo "Missing parameter for the serveur name to install, showing server game list" - fn_exec_cmd_sender exec install - #echo "enter the server name; ctrl+c to cancel" - #read -ar type - #fn_exec_cmd_sender exec install "${type}" - fi + sudo docker exec ${InstanceName} bash /home/lgsm/linuxgsm.sh install + echo "enter the server number; ctrl+c to cancel" + read -ar type + fn_exec_cmd_sender exec install "${type}" ;; "start") From 8b95649213487e0bc700dfdb875e623ed2ce54ce Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 21:53:55 -0500 Subject: [PATCH 67/70] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 16071fa..04086e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -84,7 +84,7 @@ ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 ## linuxgsm.sh -RUN wget -N --no-check-certificate https://gameservermanagers.com/dl/linuxgsm.sh +RUN wget -N --no-check-certificate https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/linuxgsm.sh ## if you have a permission probleme, check uid gid with the command id of the main linux user lgsm ## you need to have the same guid and uid as your real machine storage/data folder From c5a343b59cbad90760f8051721dc0690cb2b2917 Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Mon, 22 Jan 2018 22:07:24 -0500 Subject: [PATCH 68/70] Update linuxgsm-docker.sh --- linuxgsm-docker.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index b72393f..1081929 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -16,7 +16,7 @@ Network='host' ## Set the hostname for the docker container Hostname='LGSM' ## Set it to False if you don't have a discord custom script like me -DiscordNotifier="False" +DiscordNotifier="false" ## check if the container already running; return (true or '') status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) @@ -35,7 +35,7 @@ fn_exec_cmd_sender(){ then if [ "${2}" == "install" ] then - sudo docker "${1}" ${InstanceName} bash /home/lgsm/linuxgsm.sh auto-install "${3}" + sudo docker "${1}" ${InstanceName} bash /home/lgsm/linuxgsm.sh "${3}" else sudo docker "${1}" ${InstanceName} ${ServerType} "${2}" "${3}" fi @@ -48,10 +48,16 @@ fn_command_support(){ case ${cmd} in "install") - sudo docker exec ${InstanceName} bash /home/lgsm/linuxgsm.sh install - echo "enter the server number; ctrl+c to cancel" - read -ar type - fn_exec_cmd_sender exec install "${type}" + if [ "${3}" != "" ] + then + fn_exec_cmd_sender exec install "${3}" + else + # Get server List name + sudo docker exec ${InstanceName} bash /home/lgsm/linuxgsm.sh install + echo "enter the server name; ctrl+c to cancel" + read -a type + fn_exec_cmd_sender exec install "${type}" + fi ;; "start") @@ -147,7 +153,7 @@ then fn_command_support "${cmd}" "${2}" else echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|details|alerts|cronjob|attach|command|install}" - read -ar cmd + read -a cmd fn_command_support "${cmd}" "${2}" fi From 120fa5a786bf955576235ce4a67f074c1da0ebee Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Thu, 25 Jan 2018 17:20:52 -0500 Subject: [PATCH 69/70] remove duplication --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 04086e0..615a34b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,7 +70,6 @@ RUN apt-get install -y \ libdbus-glib-1-2:i386 \ libnm-glib-dev:i386 \ apt-transport-https \ - ca-certificates \ procps \ locales \ cron From 338445ad88544bbb5bde1b1b7922848381e03ebd Mon Sep 17 00:00:00 2001 From: jkljkl1197 Date: Wed, 14 Feb 2018 21:25:09 +0000 Subject: [PATCH 70/70] Change a remark --- linuxgsm-docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh index 1081929..0741a2f 100755 --- a/linuxgsm-docker.sh +++ b/linuxgsm-docker.sh @@ -52,7 +52,7 @@ fn_command_support(){ then fn_exec_cmd_sender exec install "${3}" else - # Get server List name + # Get List of game server name for install sudo docker exec ${InstanceName} bash /home/lgsm/linuxgsm.sh install echo "enter the server name; ctrl+c to cancel" read -a type