diff options
Diffstat (limited to 'www/tt-rss/files/ttrssd.in')
-rw-r--r-- | www/tt-rss/files/ttrssd.in | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/www/tt-rss/files/ttrssd.in b/www/tt-rss/files/ttrssd.in index 21bfde025c73..07b7a38e1c8e 100644 --- a/www/tt-rss/files/ttrssd.in +++ b/www/tt-rss/files/ttrssd.in @@ -23,6 +23,7 @@ load_rc_config "${name}" : ${ttrssd_local_db:="YES"} initdb_php="%%WWWDIR%%/update.php" +dbcheck_php="%%WWWDIR%%/ttrss_db_check.php" required_files="%%WWWDIR%%/config.php" pidfile="/var/run/${name}.pid" ppidfile="/var/run/${name}_parent.pid" @@ -37,10 +38,10 @@ start_precmd=${name}_prestart start_cmd=${name}_start stop_cmd=${name}_stop -%%MYSQL%%CHECK_CMD="%%LOCALBASE%%/bin/mysqladmin -u mysqld ping" -%%MYSQL%%CHECK_MSG="${name}: mysqladmin command failed; mysql not ready?" -%%PGSQL%%CHECK_CMD="%%LOCALBASE%%/bin/pg_isready" -%%PGSQL%%CHECK_MSG="${name}: postgresql status failed; postgresql not ready?" +MYSQL_CHECK_CMD="%%LOCALBASE%%/bin/mysqladmin -u mysqld ping" +MYSQL_CHECK_MSG="${name}: mysqladmin command failed; mysql not ready?" +PGSQL_CHECK_CMD="%%LOCALBASE%%/bin/pg_isready" +PGSQL_CHECK_MSG="${name}: postgresql status failed; postgresql not ready?" ttrssd_start() { if ! [ -x $phpcli ]; then @@ -75,6 +76,22 @@ ttrssd_prestart() { if checkyesno ttrssd_local_db; then # Wait for the local database to be started + database="$("$phpcli" -f "$dbcheck_php")" + + case "$database" in + "mysql") + CHECK_CMD="$MYSQL_CHECK_CMD" + CHECK_MSG="$MYSQL_CHECK_MSG" + ;; + "pgsql") + CHECK_CMD="$PGSQL_CHECK_CMD" + CHECK_MSG="$PGSQL_CHECK_MSG" + ;; + *) + err 1 "Unknown database configured: $database" + ;; + esac + for n in $(seq 1 10); do if $CHECK_CMD > /dev/null 2>&1; then return |