-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute.sh
More file actions
executable file
·58 lines (50 loc) · 1.99 KB
/
execute.sh
File metadata and controls
executable file
·58 lines (50 loc) · 1.99 KB
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
#!/bin/bash
# SDG: A synthetic datastream generator.
# A generator of synthetic, multivariate & heterogeneous datasteams with
# probabilistically repeating patterns.
#
# Copyright (c) 2018 Grzegorz Stepien
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# For more details, see './LICENSE.md'
# (where '.' represents this program's root directory).
# Configures and executes an SDG instance based on
# the JSON config file at './configs/synth_ds_global_options.json' where '.' represents the folder
# containing this script.
# Helper method for error printing
error_msg()
{
TITLE="Unsuccessful execution of this script via: \"$0 $CONSOLE_PARAMS\""
"$PRINTF" "ERROR: $TITLE\n\tMessage: $1\n"
}
CONSOLE_PARAMS=$@
# Check tool availability
DIRNAME=$(which dirname)
READLINK=$(which readlink)
PRINTF=$(which printf)
RSCRIPT=$(which Rscript)
if [ -z "$DIRNAME" -o -z "$READLINK" -o -z "$PRINTF" -o -z "$RSCRIPT" ]; then
error_msg "At least one required tool is missing. See \"Check tool availability\" paragraph of \"$0\" for more details."
exit 1
fi
# Folder containing this script
DRIVER_CONFIG_FOLDER=$("$DIRNAME" "$0")
DRIVER_CONFIG_FOLDER=$("$READLINK" -e "$DRIVER_CONFIG_FOLDER")
# Driver config R script
DRIVER_CONFIG="${DRIVER_CONFIG_FOLDER}/execute.R"
# Composed commands to execute
EXEC_COMMAND="\"$RSCRIPT\" \"$DRIVER_CONFIG\""
# Execute commands
eval "$EXEC_COMMAND"