Statistics
| Branch: | Tag: | Revision:

root / snf-tools / conf / snf-burnin-run.sh @ d4325f42

History | View | Annotate | Download (972 Bytes)

1
#!/bin/bash
2

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

    
7
#Usage: ./snf-burnin-run.sh
8

    
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
32

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