acme-output.sh 1.05 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash

set -e

function usage () {
    echo "Usage: $0 -stage N"
}

if [ $# -eq 0 ]; then
    usage
    exit 1
fi

while [ $# -ne 0 ]; do
    case "$1" in
        -stage)
Juve, Gideon's avatar
Juve, Gideon committed
17
            shift
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
            STAGE=$1
            ;;
        *)
            usage
            exit 1
            ;;
    esac
    shift
done

if [ -z "$STAGE" ]; then
    echo "ERROR: Specify -stage"
    usage
    exit 1
fi

Juve, Gideon's avatar
Juve, Gideon committed
34
# Get the case name
35
CASE=$(./xmlquery CASE -valonly -silent)
Juve, Gideon's avatar
Juve, Gideon committed
36
37

# Get the full path to the run directory
38
39
RUNDIR=$(./xmlquery RUNDIR -valonly -silent)
RUNDIR=$(cd $RUNDIR && pwd)
Juve, Gideon's avatar
Juve, Gideon committed
40
41

# Get the workflow scratch directory
Juve, Gideon's avatar
Juve, Gideon committed
42
DIR=$(pwd)
Juve, Gideon's avatar
Juve, Gideon committed
43
44

# The tar works better from the run dir
Juve, Gideon's avatar
Juve, Gideon committed
45
cd $RUNDIR
Juve, Gideon's avatar
Juve, Gideon committed
46
47
48

# Touch this file here so that it will always exist, even if it is empty
# for the first stage
Juve, Gideon's avatar
Juve, Gideon committed
49
touch outputs_to_ignore
Juve, Gideon's avatar
Juve, Gideon committed
50
51

# Tar up all the output files, but ignore outputs from previous stages
52
tar -czv -f $DIR/${CASE}.stage${STAGE}.tar.gz -X outputs_to_ignore ${CASE}.* rpointer.* *.log.*.gz
Juve, Gideon's avatar
Juve, Gideon committed
53
54

# Update the ignore file to ignore outputs from the current stage
55
ls ${CASE}.* *.log.* > outputs_to_ignore
56