-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherddap_utils.sh
94 lines (79 loc) · 2.5 KB
/
erddap_utils.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
export ERDDAP_AX_DIR=/opt/applications/docker-erddap
export ERDDAP_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export ERDDAP_DATASETS_XML=${ERDDAP_DIR}/content/datasets.xml
export ERDDAP_DATASETSD_DIR=${ERDDAP_DIR}/datasets.d
export ERDDAP_DATA_DIR=/srv/data/erddap
if [ -z $ERDDAP_URL ]; then
export ERDDAP_URL=http://127.0.0.1:8080/erddap
fi
erddap_vars() {
echo "ERDDAP_DIR: $ERDDAP_DIR"
echo "ERDDAP_AX_DIR: $ERDDAP_AX_DIR"
echo "ERDDAP_DATASETS_XML: $ERDDAP_DATASETS_XML"
echo "ERDDAP_DATASETSD_DIR: $ERDDAP_DATASETSD_DIR"
echo "ERDDAP_URL: $ERDDAP_URL"
}
erddap_ax_cd() {
cd $ERDDAP_AX_DIR
}
erddap_cd() {
cd $ERDDAP_DIR
}
erddap_chown_datasets() {
sudo chown $USER ${ERDDAP_DATASETS_XML}
}
erddap_chown_content() {
sudo chown -R $USER ${ERDDAP_DIR}/content
}
erddap_chown_conf() {
sudo chown -R $USER ${ERDDAP_DIR}/conf
}
erddap_index_html() {
curl "$ERDDAP_URL/index.html"
}
erddap_dataset_ids() {
curl $ERDDAP_URL/tabledap/allDatasets.tsv?datasetID
}
erddap_restart() {
pushd $ERDDAP_DIR
sudo docker compose restart
popd
}
erddap_generate_datasetsd(){
sudo bash ${ERDDAP_AX_DIR}/datasets.d.sh -d ${ERDDAP_DIR}/datasets.d -o ${ERDDAP_DIR}/content/datasets.xml -w
}
erddap_refresh_dataset() {
dataset_id=$1
hard_flag_file=${ERDDAP_DIR}/erddapData/hardFlag/${dataset_id}
echo "Creating the following hard flag file to force hard refresh of all data for dataset $dataset_id"
echo $hard_flag_file
sudo touch $hard_flag_file
echo "Restart ERDDAP to complete the dataset refresh"
}
erddap_refresh_metadata() {
dataset_id=$1
flag_file=${ERDDAP_DIR}/erddapData/flag/${dataset_id}
echo "Creating the flag file to notify ERDDAP to refresh its metadata contents as soon as possible for dataset $dataset_id"
echo $flag_file
sudo touch $flag_file
echo "ERDDAP metadata contents for this dataset should be updated shortly."
}
erddap_dasdds() {
# Once a dataset's XML is present in datasets.xml, use DasDds.sh on
# the dataset's id to test data loading with modified file/path regexes.
pushd $ERDDAP_DIR
sudo bash DasDds.sh
popd
}
erddap_archive_a_dataset() {
# Once a dataset's XML is present in datasets.xml, use ArchiveADataset.sh
# on the dataset's id to archive and place in erddapData/ArchiveADataset
pushd $ERDDAP_DIR
sudo bash ArchiveADataset.sh
popd
}
erddap_generate_datasets_xml() {
pushd $ERDDAP_DIR
sudo bash GenerateDatasetsXml.sh
popd
}