From f1f4b62e831a49c4a82992b97f017c202196b4bd Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Wed, 25 Jun 2025 21:20:35 -0400 Subject: [PATCH] Fille resetdb.sh seems to be working --- support/resetdb.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/support/resetdb.sh b/support/resetdb.sh index 742c839..5c6e452 100755 --- a/support/resetdb.sh +++ b/support/resetdb.sh @@ -4,9 +4,20 @@ #parameters ["doit"] "confdirectory #--------------------------------------------------------------- #start delay +APPLICATION=mailleur DELAY=10 DOIT=doit #--------------------------------------------------------------- +OWNER=`stat -c '%U' resetdb.sh` +USER=`id -nu` +if [ "$USER" != "$OWNER" ] ; then + echo "" + echo "-----------" + echo "ATTENTION! $0 MUST BE executed by $0 owner, exiting" + echo "-----------" + exit 1 + fi +#--------------------------------------------------------------- if [ $# -ge 1 -a "$1" != "$DOIT" ] ; then echo "" echo "-----------" @@ -19,10 +30,15 @@ if [ $# -ge 1 -a "$1" != "$DOIT" ] ; then if [ $1 == $DOIT ] ; then shift; fi +CONF=/etc/$APPLICATION/$APPLICATION.conf if [ $# -gt 0 ] ; then - . $1 + CONF=$1 fi - +if [ ! -f $CONF ] ; then + echo "configuration file $CONF is missing, exiting!" + exit 1 + fi +. $CONF #--------------------------------------------------------------- #destroying the database case "$DB_TYPE" in -- 2.47.3