#----------------------------------- # Start of user-changeable variables #----------------------------------- # # Define the client ID and name # CLIENT=-c __CLIENTID__ NAME=__NAME__ # # Define the database connection info # DBUSER=-u__DBUSER__ DBPASS=-p__DBPASS__ DBHOST=__DBHOST__ DBNAME=C_${NAME} DBLOGIN=${DBUSER} ${DBPASS} -h${DBHOST} ${DBNAME} TABLES=artist_payee artist_payee_account finance_account pending_transaction RPSMISC=/app/tools/rps/bin/misc STYLEHOME=/app/tools/support/lib/Support/DataImport/StyleTemplates DATE=__TIMESTAMP__ # # The name of the artist payee transaction template XXX # INPUT=-f "__INPUTFILE__" #--------------------------------- # # End of user-changeable variables # #--------------------------------- LOWER_NAME=$(shell echo ${NAME} | tr A-Z a-z) DUMPFILE=bk_before_${LOWER_NAME}.sql TDTOXL=${RPSMISC}/tdtoxl_v2 STYLE=${STYLEHOME}/artist_payee_transactions.fmt # PROG=${RPSMISC}/run_import.pl IMPORT_ARGS=__IMPORTID__ POSTIMPORT=${RPSMISC}/post_import.pl POST_ARGS=__POSTARGS__ EXEC=-e LOG_RO=debug_ro.txt LOG=debug.txt BASENAME=report_${LOWER_NAME}_artist_payee_transaction REPORT=${BASENAME}_import_${DATE}.txt EXCEPTIONS=exceptions_${LOWER_NAME}_PendingTransactions_ArtistPayee_${DATE}.txt EXCEPTIONS_EXCEL=exceptions_${LOWER_NAME}_PendingTransactions_ArtistPayee_${DATE}.xls PAYEE_REPORT= default: @echo make "backup|restore|template|import_test|import" backup: @mysqldump ${DBLOGIN} ${TABLES} > ${DUMPFILE} grep -i "create table" ${DUMPFILE} restore: mysql ${DBLOGIN} < ${DUMPFILE} test: nice perl ${PROG} ${CLIENT} ${INPUT} ${IMPORT_ARGS} > ${LOG_RO} import: nice perl ${PROG} ${CLIENT} ${INPUT} ${EXEC} ${IMPORT_ARGS} > ${LOG} # grep "^STATUS" ${LOG} | sed "s/^STATUS:\t//" > ${REPORT} # grep "^STATUS" ${LOG} | head -1 | sed "s/^STATUS:\t//" > ${EXCEPTIONS} grep "^STATUS" ${LOG} | grep -e "__FAIL__" | grep -v "RoyaltyShare" | sed "s/^STATUS:\t//" >> ${EXCEPTIONS} cat ${EXCEPTIONS} | ${TDTOXL} -o ${EXCEPTIONS_EXCEL} -s ${STYLE} #zip ${EXCEPTIONS_EXCEL}.zip ${EXCEPTIONS_EXCEL} nice perl ${POSTIMPORT} ${CLIENT} -f ${EXCEPTIONS_EXCEL} -l ${LOG} ${POST_ARGS} find . -type f -not -name ${EXCEPTIONS_EXCEL} -exec gzip {} \;