From: Jean-Marc Pigeon (Delson) Date: Thu, 26 Jun 2025 01:20:35 +0000 (-0400) Subject: Fille resetdb.sh seems to be working X-Git-Tag: tag-0.10~27 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=f1f4b62e831a49c4a82992b97f017c202196b4bd;p=jmp%2Fmailleur Fille resetdb.sh seems to be working --- 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