-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenerateMetadata.sh
executable file
·54 lines (43 loc) · 1.13 KB
/
GenerateMetadata.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# written by A.Neiser, [email protected]
set -e # fail on error
function start {
RUNDATADIR=$1
EXTENSION=$2
if [[ ! -d $RUNDATADIR ]]; then
echo "Please provide rundata folder as argument"
exit 1
fi
if [[ "x$EXTENSION" = "x" ]]; then
EXTENSION='*.dat.xz'
fi
find $RUNDATADIR -name $EXTENSION -type f -print0 | \
xargs -0 -n1 -P4 $0 start_wrapper
echo "Generation of Metadata finished"
}
function start_wrapper {
FILE=$1
echo "Working on $FILE..."
# try AcquHead (thru wrapper)
METADATA_ARGS=$(AcquHead-wrapper.pl $FILE)
# call Distler's script
eval "genxml.py $METADATA_ARGS \
--committer 'Andreas Neiser <[email protected]>' \
--user neiser --group kpha2 --uid 1342 --gid 4520 \
--nochecksums --nocompression --noinflate -- \
$FILE"
}
# Then, what to do finally?
case $1 in
start)
start "${@:2}"
;;
start_wrapper)
start_wrapper "${@:2}"
;;
*)
echo "Usage: $0 start <RunDataDir> ['*.dat.xz']"
exit 255
;;
esac
exit 0;