FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit ded747fa authored by Vitor Trovisco's avatar Vitor Trovisco
Browse files

Update weekly_export1.sh

parent ef12d727
No related branches found
No related tags found
No related merge requests found
......@@ -26,40 +26,47 @@ EXPORT_FILENAME=canto_server_export_latest.json
log "Exporting approved sessions into ${EXPORT_DIR}"
/etc/init.d/canto stop
if /etc/init.d/canto stop; then
log "Canto stopped"
if ./canto/script/canto_docker ./script/canto_export.pl canto-json --export-curator-names --export-approved > "${EXPORT_DIR}/${EXPORT_FILENAME}"; then
log "Export successful"
if ./canto/script/canto_docker ./script/canto_export.pl canto-json --export-curator-names --export-approved > "${EXPORT_DIR}/${EXPORT_FILENAME}"; then
log "Export successful"
/etc/init.d/canto start
if [[ -e "${EXPORT_DIR}/${EXPORT_FILENAME}" ]]; then
if [[ -e "${EXPORT_DIR}/${EXPORT_FILENAME}" ]]; then
# Create archive directory if required
ARCHIVE="${CANTOSPACE}/archive"
# Create archive directory if required
ARCHIVE="${CANTOSPACE}/archive"
if [[ ! -d "${ARCHIVE}" ]]; then
log "Creating ${ARCHIVE}"
mkdir "${ARCHIVE}"
fi
if [[ ! -d "${ARCHIVE}" ]]; then
log "Creating ${ARCHIVE}"
mkdir "${ARCHIVE}"
fi
EXPORT_FILENAME_ARCHIVE="canto_server_export_$(date +"%Y-%m-%d-%T").json"
EXPORT_FILENAME_ARCHIVE="canto_server_export_$(date +"%Y-%m-%d-%T").json"
# Copying canto_server_export_latest.json to archive
log "Copying ${EXPORT_FILENAME} to ${ARCHIVE}/${EXPORT_FILENAME_ARCHIVE}"
# Copying canto_server_export_latest.json to archive
log "Copying ${EXPORT_FILENAME} to ${ARCHIVE}/${EXPORT_FILENAME_ARCHIVE}"
cp "${EXPORT_DIR}/${EXPORT_FILENAME}" "${ARCHIVE}/${EXPORT_FILENAME_ARCHIVE}"
cp "${EXPORT_DIR}/${EXPORT_FILENAME}" "${ARCHIVE}/${EXPORT_FILENAME_ARCHIVE}"
else
log "${EXPORT_DIR}/${EXPORT_FILENAME} cannot be found - cannot continue"
fi
else
log "${EXPORT_DIR}/${EXPORT_FILENAME} cannot be found - cannot continue"
exit
fi
else
log "Export failed - cannot continue"
else
log "Export failed - aborting"
exit
fi
/etc/init.d/canto start
else
log "Canto could not stop. Cannot continue."
fi
exit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment