diff --git a/podmanctl b/podmanctl index bf28f57..5ec5528 100755 --- a/podmanctl +++ b/podmanctl @@ -37,8 +37,18 @@ fi ARGS_ENV="" while getopts ':e:' OPT; do case $OPT in - e) ARGS_ENV="${ARGS_ENV} --env ${OPTARG}";; - \?) usage; exit 1;; + e) + if [[ "${COMMAND}" =~ ^(create|run)$ ]]; then + ARGS_ENV="${ARGS_ENV} --env ${OPTARG}" + else + printf "option 'e' does not apply to command '${COMMAND}'\n" + exit 1 + fi + ;; + \?) + usage + exit 1 + ;; esac done shift $((OPTIND -1)) @@ -65,6 +75,7 @@ for PROJECT in $*; do ENVFILE="${ROOTDIR}/${PROJECT}-env.conf" PODNAME="${PROJECT}-pod" REGADDR="cor.cherished.me/cherished.me" + SYSTEMD="/etc/systemd/system" # project check if [[ ! -r $ENVFILE ]] then @@ -132,7 +143,7 @@ for PROJECT in $*; do # --------------------------------------------------------- remove pod if [[ "$(systemctl is-active podman-${PODNAME}.service)" == "active" ]]; then if systemctl list-units --full -all \ - |grep -Fq "podman-${PODNAME}.service" then + |grep -Fq "podman-${PODNAME}.service"; then systemctl stop podman-${PODNAME}.service fi else