Skip to content

Commit

Permalink
Do not allow the user to start a box when there is another one running
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanways committed Jan 14, 2024
1 parent 21670ae commit dee6304
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions includes/start_box.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ start_box() {

export dir=/var/pandoras

# Check if the directory is empty (except for .gitkeep)
isEmpty=true
shopt -s nullglob
for file in "$dir/environment"/*; do
if [ "$file" != "$dir/environment/.gitkeep" ]; then
isEmpty=false
break
fi
done

if [ "$isEmpty" = false ]; then
echo "The directory ${dir}/environment is not empty, exiting..."
exit 1
fi

# Check if a box name is provided as a command-line parameter
if [ -n "$1" ]; then
image="$1"
Expand Down

0 comments on commit dee6304

Please sign in to comment.