#!/bin/bash
source $HOME/bin/xigncode_settings

for xigncode_info_live in $(PGPASSWORD=$dbpass psql -U ${dbuser} ${dbname} -h CTRL -c "COPY (SELECT id, name, type FROM ${XIGNCODE_LOG_TABLE_NAME} WHERE status = 1 AND live_sync = 1 ORDER BY type, created_time DESC) TO STDOUT CSV;"); do
	XIGNCODE_ID=$(echo ${xigncode_info_live} | awk -F',' '{print $1}')
	XIGNCODE_FILENAME=$(echo ${xigncode_info_live} | awk -F',' '{print $2}')
	XIGNCODE_FILETYPE=$(echo ${xigncode_info_live} | awk -F',' '{print $3}')

	$HOME/bin/xigncode_patchroot_live_auto ${XIGNCODE_FILETYPE}
	echo
done
