catch errors and terminate script
This commit is contained in:
parent
7b193bfe25
commit
b1f73641c8
18
.vscode/numbered-bookmarks.json
vendored
18
.vscode/numbered-bookmarks.json
vendored
@ -1,3 +1,19 @@
|
|||||||
{
|
{
|
||||||
"bookmarks": []
|
"bookmarks": [
|
||||||
|
{
|
||||||
|
"fsPath": "$ROOTPATH$/entrypoint.sh",
|
||||||
|
"bookmarks": [
|
||||||
|
-1,
|
||||||
|
72,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
@ -21,7 +21,9 @@ chown -R mysql:mysql /var/lib/mysql
|
|||||||
for f in /docker-entrypoint-preinit.d/*.sh; do
|
for f in /docker-entrypoint-preinit.d/*.sh; do
|
||||||
if [ -s "$f" ]; then
|
if [ -s "$f" ]; then
|
||||||
printf "PRE-INIT: Executing %s\n" "$f"
|
printf "PRE-INIT: Executing %s\n" "$f"
|
||||||
/bin/sh "$f"
|
if (! /bin/sh "$f"); then
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -81,19 +83,23 @@ for f in /docker-entrypoint-initdb.d/*.sh; do
|
|||||||
*.sql)
|
*.sql)
|
||||||
if [ -s "$f" ]; then
|
if [ -s "$f" ]; then
|
||||||
printf "IMPORT-SQL: Importing %s\n" "$f"
|
printf "IMPORT-SQL: Importing %s\n" "$f"
|
||||||
mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 < "$f"
|
if (! mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 < "$f"); then
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*.sql.gz)
|
*.sql.gz)
|
||||||
if [ -s "$f" ]; then
|
if [ -s "$f" ]; then
|
||||||
printf "IMPORT-SQL: Importing %s\n" "$f"
|
printf "IMPORT-SQL: Importing %s\n" "$f"
|
||||||
gunzip -c "$f" | mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0
|
if (! gunzip -c "$f" | mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0); then
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "IMPORT-SQL: Cannot import %s\n" "$f"
|
printf "IMPORT-SQL: Cannot import %s -- skipping\n" "$f"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -102,7 +108,9 @@ done
|
|||||||
for f in /docker-entrypoint-postinit.d/*.sh; do
|
for f in /docker-entrypoint-postinit.d/*.sh; do
|
||||||
if [ -s "$f" ]; then
|
if [ -s "$f" ]; then
|
||||||
printf "POST-INIT: Executing %s\n" "$f"
|
printf "POST-INIT: Executing %s\n" "$f"
|
||||||
/bin/sh "$f"
|
if (! /bin/sh "$f"); then
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user