diff --git a/bin/dexec b/bin/dexec index 1f0ec7e..6f54b8d 100755 --- a/bin/dexec +++ b/bin/dexec @@ -1,7 +1,6 @@ #!/bin/bash denvexec() { - # Überprüfen, ob die richtige Anzahl Argumente übergeben wurden if [ $# -lt 1 ]; then echo "Verwendung: denvexec " return 1 @@ -10,9 +9,8 @@ denvexec() { local DOCKER_COMMAND="$@" local ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd ) - echo "" - echo "$ENV_DIR: $DOCKER_COMMAND" + echo "Directory: ${ENV_DIR}" #MAC if [[ "$OSTYPE" == "darwin"* ]]; then @@ -30,14 +28,11 @@ denvexec() { } dexec() { - # Überprüfen, ob die richtige Anzahl Argumente übergeben wurden if [ $# -lt 2 ]; then echo "Verwendung: dexec " return 1 fi - # convert first parameter to system-direcotry, concat the rest - # Teile den String in zwei Teile auf, getrennt durch "-" local systemPart="${1%-*}" # before "-" e.g. auth / bee / etc local typePart="${1##*-}" # after "-" e.g. backend / frontend local SYSTEM_DIR="$typePart/$systemPart" @@ -45,10 +40,10 @@ dexec() { local DOCKER_COMMAND="$@" local ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd ) - local DOT_ENV_PATH="${ENV_DIR}/systems/${SYSTEM_DIR}/.env" - echo "" - echo "$SYSTEM_DIR: $DOCKER_COMMAND" + echo "Directory: ${ENV_DIR}/systems/${SYSTEM_DIR}" + + local DOT_ENV_PATH="${ENV_DIR}/systems/${SYSTEM_DIR}/.env" #SET ENV VARIABLES FROM .ENV if [ -e "$DOT_ENV_PATH" ]; then diff --git a/bin/drun b/bin/drun index bb5351d..e4b806d 100755 --- a/bin/drun +++ b/bin/drun @@ -1,48 +1,31 @@ #!/bin/bash drun() { - # Überprüfen, ob die richtige Anzahl Argumente übergeben wurden if [ $# -lt 2 ]; then echo "Verwendung: drun " return 1 fi - # Container-Namen extrahieren local CONTAINER_NAME="$1" shift # Das erste Argument entfernen - - # Den Rest der Argumente als Befehlszeichenfolge zusammenfügen local COMMAND="$@" - - # Container-ID mithilfe des Container-Namens finden local CONTAINER_ID=$(docker ps -qf "name=$CONTAINER_NAME-app") - # Überprüfen, ob der Container gefunden wurde if [ -z "$CONTAINER_ID" ]; then echo "Container '$CONTAINER_NAME' wurde nicht gefunden." return 1 fi - # Befehl im Container ausführen docker exec -it "$CONTAINER_ID" $COMMAND } _drun_completion() { local cur prev opts - COMPREPLY=() # Array, das die Vorschläge enthalten wird - cur="${COMP_WORDS[COMP_CWORD]}" # Das aktuelle Wort, das vervollständigt werden soll - prev="${COMP_WORDS[COMP_CWORD-1]}" # Das vorherige Wort - - # Hier definierst du die Optionen oder Argumente, die `drun` akzeptiert + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" opts="start stop restart status" - # Wenn die Optionen abhängig vom vorherigen Wort sind, kannst du hier Bedingungen hinzufügen - # Beispiel: - # if [[ ${prev} == "start" ]]; then - # opts="service1 service2 service3" - # fi - - # Die verfügbaren Optionen auf das aktuelle Eingabewort filtern COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 } diff --git a/bin/script/foreachSystem b/bin/script/foreachSystem index 52f9bcd..2cbff86 100755 --- a/bin/script/foreachSystem +++ b/bin/script/foreachSystem @@ -5,7 +5,6 @@ ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/../.." &> /dev/null && pwd source ${ENV_DIR}/bin/dexec -# Überprüfen, ob die richtige Anzahl Argumente übergeben wurden if [ $# -lt 1 ]; then echo "Verwendung: foreachSystem up -d" return 1 @@ -13,10 +12,7 @@ fi for SYSTEM in $ENV_DIR/systems/*/*/ ; do - # Extrahiere den Teil nach "systems/" relative_path="${SYSTEM#*/systems/}" - - # Entferne den abschließenden Schrägstrich relative_path="${relative_path%/}" typePart="${relative_path%/*}" # before "/" eg. backend / frontend diff --git a/cron/.gitignore b/cron/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/cron/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/setup b/setup index 21d109b..e5ebc32 100755 --- a/setup +++ b/setup @@ -30,4 +30,4 @@ echo "source $ENV_DIR/bin/git" >> ~/.profile echo "appending dev-env .profile to .profile" echo "" >> ~/.profile -cat .profile >> ~/.profile \ No newline at end of file +cat .profile >> ~/.profile