Revision 076a2dc0 snf-tools/conf/snf-burnin-run.sh

b/snf-tools/conf/snf-burnin-run.sh
1
#! /bin/bash
1
#!/bin/bash
2 2

  
3 3
#Example script for an snf-burnin cronjob.
4 4
#Starts an a snf-burnin test, deletes stale instances and archives old logs.
5 5
#It aborts if snf-burnin runs for longer than expected.
6 6

  
7
#Usage: ./snf-burnin-run.sh TOKEN IMAGE-ID LOG-FOLDER
7
#Usage: ./snf-burnin-run.sh
8 8

  
9
timeout --foreground 25m snf-burnin --token="$1" --image-id="$2" --action-timeout 120 --log-folder "$3"
10
snf-burnin --token="$1" --delete-stale
9
API=""
10
PLANKTON=""
11
PLANKTON_USER=""
12
TOKEN=""
13
IMAGEID=""
14
OUTPUT=""
15

  
16
# Delete previously stalled objects.
17
snf-burnin --api=$API --token=$TOKEN --delete-stale
18

  
19
# Run burnin for 25 minutes. Fail after that.
20
timeout --foreground 25m \
21
    snf-burnin --api=$API \
22
               --plankton=$PLANKTON \
23
               --plankton-user=$PLANKTON_USER \
24
               --token=$TOKEN \
25
               --image-id=$IMAGEID \
26
               --action-timeout 120 \
27
               --log-folder=$OUTPUT \
28
               --nofailfast
29

  
30
# Delete possibly stalled objects.
31
snf-burnin --api=$API --token=$TOKEN --delete-stale
11 32

  
12 33
#Delete old folders
13 34
old=$(date -d "1 week ago" +%Y%m%d%H%M%S)
14
for dir in ${3}/* ; do
35
for dir in $OUTPUT/* ; do
15 36
    d=`basename $dir`
16 37
    (($d<$old)) && rm -r "$dir"
17 38
done

Also available in: Unified diff