-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclose-exec.sh
More file actions
executable file
·57 lines (41 loc) · 1.22 KB
/
close-exec.sh
File metadata and controls
executable file
·57 lines (41 loc) · 1.22 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
#!/bin/bash
function usage() {
echo "Usage: $0 <iteration name>"
echo "e.g. $0 mock1"
}
if [[ ( "$#" -ne 1 ) ]]; then
usage
exit 1
fi
INPUT_EXECUTION_NAME=$1
if [ -z "${INPUT_EXECUTION_NAME}" ]; then
usage
exit 1
fi
if [ ! -f ./conf/.project.env.sh ]; then
echo "Misconfigured installation - missing files in conf directory"
exit 10
fi
source ./conf/.project.env.sh
if [ ! -f $PRECISION100_PROJECT_CONF_FOLDER/.env.sh ]; then
echo "Misconfigured installation - Invalid Precision100 installation"
exit 10
fi
source $PRECISION100_PROJECT_CONF_FOLDER/.env.sh
EXECUTION_PID_FILE="$PRECISION100_PROJECT_CONF_FOLDER/.execution.pid"
if [ ! -f "$EXECUTION_PID_FILE" ]; then
echo "Cannot close iteration. No executing iteration identified"
exit 10
fi
PRECISION100_EXECUTION_NAME=$(cat $EXECUTION_PID_FILE)
if [ ! $INPUT_EXECUTION_NAME = $PRECISION100_EXECUTION_NAME ]; then
echo "Currently executing $PRECISION100_EXECUTION_NAME. Cannot close $INPUT_EXECUTION_NAME"
exit 10
fi
read -p "Closing iteration $INPUT_EXECUTION_NAME. Please confirm (y/n) " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
## Just deleting PID file for now
rm -f $EXECUTION_PID_FILE
fi