From 23abdcb305a44755b631e8529d075749658e8679 Mon Sep 17 00:00:00 2001 From: Pedro Salgado Date: Fri, 30 Dec 2016 14:45:59 -0700 Subject: [PATCH] added bash scripts to start, stop and login to a container. --- login.sh | 30 ++++++++++++++++++++++++++++++ start_container.sh | 35 +++++++++++++++++++++++++++++++++++ stop_container.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100755 login.sh create mode 100755 start_container.sh create mode 100755 stop_container.sh diff --git a/login.sh b/login.sh new file mode 100755 index 0000000..e65576a --- /dev/null +++ b/login.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# ##### +# +# Login to a running Odoo container. +# +# usage: +# +# bash login.sh 9.0 20160101 +# +# author: Pedro Salgado +# version: 1.0 +# +# ##### + + +ODOO_VERSION="$1" +ODOO_RELEASE="$2" + + +validation() { + : "${ODOO_VERSION:?first argument needs to be set to the Odoo version (8.0, 9.0 or 10.0).}" + : "${ODOO_RELEASE:?second argument needs to be set to the Odoo release (e.g. 20160101).}" +} + + +validation + +docker exec \ + -it "odoo.${ODOO_VERSION}_${ODOO_RELEASE}" \ + bash diff --git a/start_container.sh b/start_container.sh new file mode 100755 index 0000000..1c43dc0 --- /dev/null +++ b/start_container.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# ##### +# +# Start an Odoo container. +# +# usage: +# +# bash start_container.sh 9.0 20160101 +# +# author: Pedro Salgado +# version: 1.0 +# +# ##### + + +ODOO_VERSION="$1" +ODOO_RELEASE="$2" + + +validation() { + : "${ODOO_VERSION:?first argument needs to be set to the Odoo version (8.0, 9.0 or 10.0).}" + : "${ODOO_RELEASE:?second argument needs to be set to the Odoo release (e.g. 20160101).}" +} + + +validation + +IMAGE_ODOO="steenzout/odoo:${ODOO_VERSION}.${ODOO_RELEASE}" + +docker run \ + -h web \ + --name "odoo.${ODOO_VERSION}_${ODOO_RELEASE}" \ + -p 127.0.0.1:8069:8069 \ + -td \ + "${IMAGE_ODOO}" diff --git a/stop_container.sh b/stop_container.sh new file mode 100755 index 0000000..b5ef444 --- /dev/null +++ b/stop_container.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# ##### +# +# Stop and remove a running Odoo container. +# +# usage: +# +# bash stop_container.sh 9.0 20160101 +# +# author: Pedro Salgado +# version: 1.0 +# +# ##### + + +ODOO_VERSION="$1" +ODOO_RELEASE="$2" + + +validation() { + : "${ODOO_VERSION:?first argument needs to be set to the Odoo version (8.0, 9.0 or 10.0).}" + : "${ODOO_RELEASE:?second argument needs to be set to the Odoo release (e.g. 20160101).}" +} + + +validation + +docker stop \ + "odoo.${ODOO_VERSION}_${ODOO_RELEASE}" + +docker rm \ + "odoo.${ODOO_VERSION}_${ODOO_RELEASE}"