ansible-role-ckan/templates/clear_harvesting_history.sh.j2

20 lines
632 B
Django/Jinja

#!/bin/bash
if [ "$( id -u -n )" != "{{ ckan_shell_user }}" ] ; then
logger "ckan_clear_harvesting_history: must be executed by the ckan user"
exit 1
fi
# shellcheck disable=SC1091
source "/usr/lib/ckan/default/bin/activate"
ckan_source_ids=$( paster --plugin=ckanext-harvest harvester sources --config={{ ckan_config_file }} | grep -E "^Source\ id:" | awk '{ print $3 }' )
for id in $ckan_source_ids ; do
echo "----------"
echo "Source id: ${id}"
echo "----------"
paster --plugin=ckanext-harvest harvester clearsource_history "${id}" --config={{ ckan_config_file }}
done
exit 0