#!/bin/bash

# For a given database, export all of the detections, orbits, and tracklets for all known tracklets.
#
# Usage
#
#     manual-export-known

export PERL5LIB=/usr/local/MOPS/mpc-export/lib/perl5:$PERL5LIB
export PATH=/usr/local/MOPS/mpc-export/bin:$PATH
export MPC_EXPORT_BIN=/usr/local/MOPS/mpc-export/bin

EXPORT_IS_SET=`get-mpc-export-flag.pl $MOPS_DBINSTANCE`;

if [ $EXPORT_IS_SET == 1 ]; then
    echo "Performing manual MPC export (all) of known tracklets on database $MOPS_DBINSTANCE."

    $MPC_EXPORT_BIN/process-known-detections.pl --iss_only --noprompt $MOPS_DBINSTANCE
    $MPC_EXPORT_BIN/export-pending-mops-objects-to-mpc-datastore.pl --noprompt --only_known $MOPS_DBINSTANCE
else
    echo "Data will NOT be exported to the MPC."
fi
