diff --git a/dist/docker/server/debian/jessie/x86_64/server.sh b/dist/docker/server/debian/jessie/x86_64/server.sh index cefca0883..598576b46 100755 --- a/dist/docker/server/debian/jessie/x86_64/server.sh +++ b/dist/docker/server/debian/jessie/x86_64/server.sh @@ -20,6 +20,7 @@ declare -i STOPKHANAT=0 declare -i CLEANCONTAINERKHANAT=0 declare -i CONNECTSSHKHANAT=0 declare -i KHANAT_CLIENT_VERSION=1 +declare -i SHOWIPKHANATSERVER=0 declare IMAGEGENERICSERVER="server_generic_debian_jessie_x86_64" declare IMAGEKHANATSERVER="server_khanat_debian_jessie_x86_64" @@ -49,6 +50,7 @@ options: -n, --no-launch-khanat : Doesn't launch khanat server -s, --stop-server : Stop server khanat -c, --clean-container-khanat : Remove old server khanat (stopped) + -i, --show-ip-khanat-server : show ip address for khanat server (launch under docker) --ssh : connect on khanat server (with ssh) [Exclusive action, can't execute other action] --client-version=[INTEGER] : version client khanat (we need to communicate with our server) @@ -82,7 +84,7 @@ function msg_error() # MAIN # -msg_info "START" +#msg_info "START" calldir="$(dirname $0)" basedir=$(cd $calldir; pwd) @@ -137,6 +139,10 @@ do KHANATSERVER=1 shift ;; + -i|--show-ip-khanat-server) + SHOWIPKHANATSERVER=1 + shift + ;; --client-version*) KHANAT_CLIENT_VERSION="${1#*=}" shift @@ -157,6 +163,11 @@ function chrashed() trap chrashed EXIT +if [[ $SHOWIPKHANATSERVER -eq 0 ]] +then + msg_info "START" +fi + msg_debug "prg: $0" docker -v 1>/dev/null @@ -179,15 +190,25 @@ case "$(uname -m)" in ;; esac -if [[ $CONNECTSSHKHANAT -ne 0 ]] +if [[ ($CONNECTSSHKHANAT -ne 0) || ($SHOWIPKHANATSERVER -ne 0) ]] then listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')" if [[ ${#listcontainer[@]} -eq 1 ]] then - ipaddress=$(docker inspect --format="{{ .NetworkSettings.IPAddress }}" ${listcontainer[@]}) - ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no compil@$ipaddress fi +fi + +if [[ $SHOWIPKHANATSERVER -ne 0 ]] +then + trap '' EXIT + echo "$ipaddress" + exit 0 +fi + +if [[ $CONNECTSSHKHANAT -ne 0 ]] +then + ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no compil@$ipaddress trap '' EXIT msg_info "END SSH" exit 0