Skip to content

Instantly share code, notes, and snippets.

@krzysbaranski
Created November 8, 2019 16:55
Show Gist options
  • Save krzysbaranski/b3487899a605db5dcf6945037e607f3b to your computer and use it in GitHub Desktop.
Save krzysbaranski/b3487899a605db5dcf6945037e607f3b to your computer and use it in GitHub Desktop.
#!/bin/bash
export RD_URL='http://localhost:4440'
export RD_TOKEN="@option.rundeck_token@"
export CURRENT_DATE=$(date -u -d now "+%Y-%m-%d %H:%M:%S")
echo "${CURRENT_DATE} starting job"
echo "[email protected]_time@"
echo "[email protected]_time@"
RUN_JOB_ID="xxxxx-xxxx-xxxxx-xxxx"
PROJECT="rundeck-project"
D="@option.start_time@"
DEND="@option.end_time@"
TS=$(date -u -d "${D}" +%s)
TSEND=$(date -u -d "${DEND}" +%s)
while [ $TS -le $TSEND ]
do
echo "##################################################################"
D2=$(date -u -d@${TS} +"%Y%m%d%H")
TS=$(($TS+3600))
echo "running ${D2}"
rd run -f --project ${PROJECT} --id ${RUN_JOB_ID} --progress -- -hours 1 -prefix @option.prefix@ -start_date ${D2}
done
echo "DONE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment