root / snf-tools / conf / snf-burnin-run.sh @ 56d5c612
History | View | Annotate | Download (527 Bytes)
1 | 56d5c612 | John Giannelos | #! /bin/bash |
---|---|---|---|
2 | 56d5c612 | John Giannelos | |
3 | 56d5c612 | John Giannelos | #Example script for an snf-burnin cronjob. |
4 | 56d5c612 | John Giannelos | #Starts an a snf-burnin test, deletes stale instances and archives old logs. |
5 | 56d5c612 | John Giannelos | #It aborts if snf-burnin runs for longer than expected. |
6 | 56d5c612 | John Giannelos | |
7 | 56d5c612 | John Giannelos | #Usage: ./snf-burnin.cron.example TOKEN IMAGE-ID LOG-FOLDER |
8 | 56d5c612 | John Giannelos | |
9 | 56d5c612 | John Giannelos | timeout 28m snf-burnin --token="$1" --image-id="$2" --action-timeout 120 --log-folder "$3" |
10 | 56d5c612 | John Giannelos | snf-burnin --token="$1" --delete-stale |
11 | 56d5c612 | John Giannelos | |
12 | 56d5c612 | John Giannelos | #Delete old folders |
13 | 56d5c612 | John Giannelos | old=$(date -d "1 week ago" +%Y%m%d%H%M%S) |
14 | 56d5c612 | John Giannelos | for dir in ${3}/* ; do |
15 | 56d5c612 | John Giannelos | d=`basename $dir` |
16 | 56d5c612 | John Giannelos | (($d<$old)) && rm -r "$dir" |
17 | 56d5c612 | John Giannelos | done |