Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titleDBclear script
linenumberstrue
# script assumes that opennsa code is at /usr/src/opennsa 
# LOC1m LOC2 ... LOCn represents uPA instances for individual locations. Scripts assumes that aggregator instances is called "main"  
# the SQL file droptable.sql is needed at the same place as this script

cd /usr/src/opennsa
cp datafiles/schema.sql /tmp/
for l in LOC1 LOC2 main; do
        echo "Dropping tables from opennsa-$l"
        su - opennsa -c "
        psql opennsa-$l -c '\i ~opennsa./droptables.sql'
        "
        su - opennsa -c "
        psql opennsa-$l -c '\i /tmp/schema.sql'
        "

done


for l in LOC1 LOC2 main; do
        /etc/init.d/opennsa-$l restart
        sleep 1
done

...