summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-12-29 10:13:59 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2017-01-04 10:22:39 +0000
commitad3e6002999e9b1e375e92b94c862b125a2ce86e (patch)
tree34f7773eace4c7d9b7d7267ef3a8ae41307b4467
parentUpdating year in copyright information for 2017. (diff)
downloadcompute-tools-ad3e6002999e9b1e375e92b94c862b125a2ce86e.tar.xz
compute-tools-ad3e6002999e9b1e375e92b94c862b125a2ce86e.zip
Adding -f, --force option in container auto command.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-xlib/container/auto21
-rw-r--r--share/man/container-auto.1.txt3
2 files changed, 20 insertions, 4 deletions
diff --git a/lib/container/auto b/lib/container/auto
index 69fe21b..45aa68f 100755
--- a/lib/container/auto
+++ b/lib/container/auto
@@ -25,8 +25,8 @@ HOOKS="/etc/container-tools/hooks"
Parameters ()
{
- GETOPT_LONGOPTIONS="start,stop,"
- GETOPT_OPTIONS="s,t,"
+ GETOPT_LONGOPTIONS="force,start,stop,"
+ GETOPT_OPTIONS="f,s,t,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -41,6 +41,11 @@ Parameters ()
while true
do
case "${1}" in
+ -f|--force)
+ FORCE="true"
+ shift 1
+ ;;
+
-s|--start)
ACTION="start"
shift 1
@@ -66,7 +71,7 @@ Parameters ()
Usage ()
{
- echo "Usage: container ${COMMAND} -s|--start -t|--stop" >&2
+ echo "Usage: container ${COMMAND} -f|--force -s|--start -t|--stop" >&2
exit 1
}
@@ -89,13 +94,21 @@ do
done
# Run
+OPTIONS=""
+
+case "${FORCE}" in
+ true)
+ OPTIONS="${OPTIONS} -f"
+ ;;
+esac
+
for FILE in "${CONFIG}"/*.conf
do
if grep -Eqs "^ *cnt.auto=true" "${FILE}" || grep -Eqs "^ *cnt.auto=${HOST}" "${FILE}"
then
CONTAINER="$(basename ${FILE} .conf)"
- cnt ${ACTION} -n ${CONTAINER} || true
+ cnt ${ACTION} -n ${CONTAINER} ${OPTIONS} || true
fi
done
diff --git a/share/man/container-auto.1.txt b/share/man/container-auto.1.txt
index 64e456a..5aaf0d1 100644
--- a/share/man/container-auto.1.txt
+++ b/share/man/container-auto.1.txt
@@ -41,6 +41,9 @@ OPTIONS
-------
The following container options are available:
+*-f, --force*::
+ Removing stray lock file if existing.
+
*-s, --start*::
Start all container on the host system.