Skip to content

Example usage bash script for cron job

ㅤ edited this page Apr 24, 2020 · 3 revisions

This is an example of what an Ansible template for a bash script executing the job runner looks like:

#! /usr/bin/env bash

# A job to mark records as 'Don't Publish to External Catalog' if they are suppressed.

export ALMA_API_JOB_RUNNER_NAME="Set suppressed records as 'Don't Publish to external catalog' if not already set"
export ALMA_API_JOB_RUNNER_DOMAIN="api-ca.hosted.exlibrisgroup.com"
export ALMA_API_JOB_RUNNER_KEY="{{ alma_api_job_runner_key }}"
export ALMA_API_JOB_RUNNER_MAILFROM="{{ alma_api_job_runner_mail_from }}"
export ALMA_API_JOB_RUNNER_MAILTO="{{ alma_api_job_runner_mail_to }}"
export ALMA_API_JOB_RUNNER_PARAMS="/opt/alma-api-job-runner/dontpublishsuppressed-parameters.xml"
export ALMA_API_JOB_RUNNER_SMTPSERVER="{{ alma_api_smtp_server }}"
export ALMA_API_JOB_RUNNER_URL="/almaws/v1/conf/jobs/SOMEJOBID?op=run"

/opt/alma-api-job-runner/alma-api-job-runner -email &>"/opt/alma-api-job-runner/log/$(date +%F)-dontpublishsuppressed.txt"

# Clean up old files
find /opt/alma-api-job-runner/log -mtime +30 -type f -name '*dontpublishsuppressed.txt' -delete
Clone this wiki locally