#!/bin/bash


LONG_DATE=`date +%Y%m%d%H%M%S`

/etc/init.d/d1-processing stop

update-rc.d -f d1-processing remove

rm -f /etc/init.d/d1-processing

rm -rf /etc/dataone/process
#rm -rf /var/log/dataone/daemon
#rm -rf /var/log/dataone/synchronize
#rm -rf /var/log/dataone/replicate
#rm -rf /var/log/dataone/logAggregate

rm -f /var/run/d1-processing.pid

rm -f /usr/share/java/d1_process_daemon.jar

### Handle postgres cleanup
PG=postgresql
PG_USER=postgres

## Restart the postgres db
echo "Restarting postgres database"
/etc/init.d/${PG} restart

## Update DateONE Version Info Doc
java -jar /usr/share/dataone-cn-version-tool/dataone-cn-version-tool.jar -F/usr/share/dataone-cn-version-tool/version-tool.properties -html > /var/www/cn-version.html