From e62ef77c8246175e8d530c19f33226fd4a22e385 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 30 Jul 2014 14:58:14 +0200 Subject: [PATCH] Check the database has been initialized before running the daemon --- root/var/service/phplist/run | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/root/var/service/phplist/run b/root/var/service/phplist/run index d4db6e8..9d6013a 100644 --- a/root/var/service/phplist/run +++ b/root/var/service/phplist/run @@ -2,8 +2,16 @@ exec 2>&1 -cd /usr/share/phplist/bin +# Check if database is initialized +DB=$(/sbin/e-smith/db configuration getprop phplist DbName || echo phplist) +/usr/bin/mysql $DB -e "SELECT value FROM phplist_config WHERE item='version';" >/dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "PHPList database not initialized yet" + sv d . + exit 0 +fi +cd /usr/share/phplist/bin while true; do /usr/local/bin/setuidgid www ./phplist -pprocessbounces /usr/local/bin/setuidgid www ./phplist -pprocessqueue