Forth Commit

This commit is contained in:
Andrew Hurley 2023-02-26 23:27:02 +08:00
parent 3ef215a4e1
commit a7188b0ecd
1 changed files with 14 additions and 3 deletions

View File

@ -37,8 +37,18 @@ fi
ARGS_ENV="" ARGS_ENV=""
while getopts ':e:' OPT; do while getopts ':e:' OPT; do
case $OPT in case $OPT in
e) ARGS_ENV="${ARGS_ENV} --env ${OPTARG}";; e)
\?) usage; exit 1;; 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 esac
done done
shift $((OPTIND -1)) shift $((OPTIND -1))
@ -65,6 +75,7 @@ for PROJECT in $*; do
ENVFILE="${ROOTDIR}/${PROJECT}-env.conf" ENVFILE="${ROOTDIR}/${PROJECT}-env.conf"
PODNAME="${PROJECT}-pod" PODNAME="${PROJECT}-pod"
REGADDR="cor.cherished.me/cherished.me" REGADDR="cor.cherished.me/cherished.me"
SYSTEMD="/etc/systemd/system"
# project check # project check
if [[ ! -r $ENVFILE ]] then if [[ ! -r $ENVFILE ]] then
@ -132,7 +143,7 @@ for PROJECT in $*; do
# --------------------------------------------------------- remove pod # --------------------------------------------------------- remove pod
if [[ "$(systemctl is-active podman-${PODNAME}.service)" == "active" ]]; then if [[ "$(systemctl is-active podman-${PODNAME}.service)" == "active" ]]; then
if systemctl list-units --full -all \ if systemctl list-units --full -all \
|grep -Fq "podman-${PODNAME}.service" then |grep -Fq "podman-${PODNAME}.service"; then
systemctl stop podman-${PODNAME}.service systemctl stop podman-${PODNAME}.service
fi fi
else else