Using wrolpi user to check for database in help script.

This commit is contained in:
Roland 2023-10-09 13:16:07 -06:00
parent 8230174fcd
commit 51453ad6cc
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93

10
help.sh
View file

@ -80,13 +80,13 @@ psql -l >/dev/null 2>/dev/null &&
echo "OK: Connected to postgres" ||
echo "FAILED: Unable to connect to postgres"
if psql -l 2>/dev/null | grep wrolpi >/dev/null; then
if sudo -u wrolpi psql -l 2>/dev/null | grep wrolpi >/dev/null; then
echo "OK: Found wrolpi database"
if psql wrolpi -c '\d' | grep "file_group" >/dev/null; then
if sudo -u wrolpi psql wrolpi -c '\d' | grep "file_group" >/dev/null; then
echo "OK: WROLPi database is initialized"
if [ "$(psql wrolpi -c 'copy (select count(*) from file_group) to stdout')" -gt 0 ]; then
if [ "$(sudo -u wrolpi psql wrolpi -c 'copy (select count(*) from file_group) to stdout')" -gt 0 ]; then
echo "OK: WROLPi database has files"
else
echo "FAILED: WROLPi database has no files"
@ -184,10 +184,10 @@ fi
echo
# Map
if psql -l 2>/dev/null | grep gis >/dev/null; then
if sudo -u _renderd psql -l 2>/dev/null | grep gis >/dev/null; then
echo "OK: Found map database"
if psql gis -c '\d' | grep water_polygons >/dev/null; then
if sudo -u _renderd psql gis -c '\d' | grep water_polygons >/dev/null; then
echo "OK: Map database is initialized"
else
echo "FAILED: Map database is not initialized"