#!/bin/bash

PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin/X11:/usr/games:/usr/local/bin:/root/bin

TITLE="Euro3G - Allineamento forzato della struttura DB "

MYSQL="mysql -peuro3g -ueuro3g eurotest"

source /opt/euro-beta/set3g_env
if ! which sysquery >/dev/null 2>&1 ;
then
  PATH=$PATH:/opt/euro-beta
fi
if [ -z "$DISPLAY" ]
then
  export DISPLAY=:0
fi

sysquery "$TITLE" "<b>Volete allineare la struttura del DB in base all'ultimo aggiornamento installato ?</b><br>Se si scegle di procedere, attendere il messagio di completamento della procedura" "Si, procedere" "No, non fare niente"
if [ $? == 0 ] ;
then
  cat /opt/euro-beta/systools/distr/modifiche.sql | /opt/euro-beta/systools/patch_sql | $MYSQL -f 2>/dev/null
  sysmsg "$TITLE" "Operazione terminata"
fi
exit 0
