-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·42 lines (35 loc) · 1023 Bytes
/
run.sh
File metadata and controls
executable file
·42 lines (35 loc) · 1023 Bytes
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
#!/bin/bash
OUTPUTS_DIR=./outputs
CURRENT_OUTPUT_DIR=$OUTPUTS_DIR/current
QUEUES_DIR=./queues
ACTIVE_QUEUE_DIR=$QUEUES_DIR/active
RUN_AT=$(date +%F_%H:%M:%S)
if [[ ! -d $ACTIVE_QUEUE_DIR ]]; then
echo "$ACTIVE_QUEUE_DIR directory not found, create it and add your configuration file(s). exiting ..."
exit 1
fi
if [[ -d $OUTPUTS_DIR ]]; then
rm -r $OUTPUTS_DIR
fi
mkdir $OUTPUTS_DIR
function cleanup() {
if [[ -d $CURRENT_OUTPUT_DIR ]]; then
if [[ -f $CURRENT_OUTPUT_DIR/.success ]]; then
mv $CURRENT_OUTPUT_DIR $OUTPUTS_DIR/$(cat $CURRENT_OUTPUT_DIR/.run_at)
else
rm -r $CURRENT_OUTPUT_DIR
fi
fi
mkdir $CURRENT_OUTPUT_DIR
date +%F_%H:%M:%S >$CURRENT_OUTPUT_DIR/.run_at
}
for env_file in "$ACTIVE_QUEUE_DIR"/*.conf; do
cp $env_file .env
cleanup && cp .env $CURRENT_OUTPUT_DIR/.conf && python ./src/main.py
rm .env
done
if [[ $? -eq 0 ]]; then
mkdir -p $QUEUES_DIR/$RUN_AT
cp -r $ACTIVE_QUEUE_DIR $QUEUES_DIR/$RUN_AT/configs
cp -r $OUTPUTS_DIR $QUEUES_DIR/$RUN_AT/
fi