c
This commit is contained in:
1 parent
d3d9614825
commit
2e9c775599
34 files changed
+390
-1833
No files matched your search
@@ -9,14 +9,14 @@ fi
|
||||
SEARCH="$1"
|
||||
DB_PATH="/4server/data/contracts.db"
|
||||
|
||||
# Get all UUIDs where tags include the search string
|
||||
uuids=$(sqlite3 "$DB_PATH" "SELECT UUID FROM containers WHERE tags LIKE '%$SEARCH%';")
|
||||
# Get all container_ids where tags include the search string
|
||||
container_ids=$(sqlite3 "$DB_PATH" "SELECT UUID FROM containers WHERE tags LIKE '%$SEARCH%';")
|
||||
|
||||
# Loop through each UUID
|
||||
for uuid in $uuids; do
|
||||
# Loop through each container_id
|
||||
for container_id in $container_ids; do
|
||||
# Check if a container with this name is running
|
||||
if doas docker ps --format '{{.Names}}' | grep -qx "$uuid"; then
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') Restarting $uuid"
|
||||
/4server/sbin/startContainer $uuid
|
||||
if doas docker ps --format '{{.Names}}' | grep -qx "$container_id"; then
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') Restarting $container_id"
|
||||
"$(dirname "$(realpath "${BASH_SOURCE[0]:-$0}")")/startContainer" "$container_id"
|
||||
fi
|
||||
done
|
||||
Reference in new issue
Block a user