Skip to content

Commit f9afe40

Browse files
committed
atlas lock
1 parent 9283ce0 commit f9afe40

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

go/script/migrate_up_test.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
if pgrep -x atlas > /dev/null; then
2-
echo "Error: Another atlas instance is already running"
3-
exit 1
1+
LOCK_FILE="/tmp/atlas_migrate.lock"
2+
3+
exec 200>"$LOCK_FILE"
4+
if ! flock -n 200; then
5+
echo "Waiting for another atlas instance to complete..."
6+
flock 200
47
fi
58

69
atlas schema apply \
710
-u "$1" \
811
--to file://pkg/log/store/schema/ \
912
--dev-url "docker://postgres/15/dev" \
1013
--auto-approve
14+
15+
flock -u 200

0 commit comments

Comments
 (0)