2023-08-02 20:59:59 +00:00
|
|
|
#! /bin/sh
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
# Check flat file
|
|
|
|
test -f /data/test.txt
|
|
|
|
grep "^Hello" /data/test.txt
|
|
|
|
|
|
|
|
# Check Sqlite database
|
|
|
|
test -f /data/test_database.db
|
|
|
|
sqlite3 /data/test_database.db "select data from test_table where id = 1" | grep "^Test row"
|
|
|
|
|
|
|
|
# Check MySql database
|
2023-08-02 22:05:04 +00:00
|
|
|
mysql --host "$MYSQL_HOST" --user "$MYSQL_USER" --password="$MYSQL_PWD" main <<EOF | grep "^Test row"
|
|
|
|
select data from test_table where id = 1;
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Check Postgres database
|
|
|
|
export PGPASSWORD="$PGSQL_PASS"
|
|
|
|
psql --host "$PGSQL_HOST" --user "$PGSQL_USER" main <<EOF | grep "Test row"
|
2023-08-02 20:59:59 +00:00
|
|
|
select data from test_table where id = 1;
|
|
|
|
EOF
|