#!/bin/bash PROGNAME="$0" EXECUTE=0 RAKE_COMMAND="${RAKE_COMMAND:-"foreman-rake"}" function die() { local code="$1" local message="$2" echo "$message" >&2 exit $code } function build_rake() { echo -n "$RAKE_COMMAND " echo -n 'foreman_tasks:cleanup ' for env in AFTER TASK_BACKUP BATCH_SIZE NOOP TASK_SEARCH STATES VERBOSE; do local value="${!env}" [ -n "${value}" ] && echo -n "${env}=$(printf '%q' "$value") " done echo } function usage() { cat << EOF Usage: $PROGNAME [script_options...] [options...] An interface script for setting environment variables properly for foreman-tasks:cleanup rake task. By default only prints the command to run, with -E|--execute flag performs the cleanup. Environment variables: RAKE_COMMAND: can be used to redefine path to rake, by default foreman-rake Script options: EOF cat <