]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Fille resetdb.sh seems to be working
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Thu, 26 Jun 2025 01:20:35 +0000 (21:20 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Thu, 26 Jun 2025 01:20:35 +0000 (21:20 -0400)
support/resetdb.sh

index 742c839a0273c5eb8ea724f688bf1482f3daf018..5c6e4528556f5c4dd974c1847254b43932494395 100755 (executable)
@@ -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