forked from open-oni/open-oni
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch_load_batches.sh
More file actions
executable file
·35 lines (27 loc) · 1.11 KB
/
Copy pathbatch_load_batches.sh
File metadata and controls
executable file
·35 lines (27 loc) · 1.11 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
# Start loading sample batches:
OPENONI_INSTALL_DIR = "/opt/openoni"
echo "creating log file:"
log_file="${OPENONI_INSTALL_DIR}/load_batch_log_$(date +%Y%m%d%H%M%S).log"
touch $log_file
echo "log file: $log_file created." 2>&1 | tee -a $log_file
# Loading batches:
list_of_batches="${OPENONI_INSTALL_DIR}/batch_names.txt"
if [ ! -f "$list_of_batches"]; then
echo "Batch Name File Not Found!"
exit 1
fi
echo "Begin loading batches:" 2>&1 | tee -a $log_file
source ENV/bin/activate
while IFS= read -r batch_name || [ -n "$batch_name" ]; do
if [ -n "$batch_name" ]; then
command="./manage.py load_batch ${OPENONI_INSTALL_DIR}/data/batches/${batch_name}"
echo "Loading batch: $command" 2>&1 | tee -a "$log_file"
eval "$command" 2>&1 | tee -a "$log_file"
fi
done < "$list_of_batches"
echo "Done loading batches." 2>&1 | tee -a $log_file
# Change django cache permission.
echo "Changing django_cache permission." 2>&1 | tee -a $log_file
chmod -R 777 /var/tmp/django_cache
echo "django_cache changed to 777" 2>&1 | tee -a $log_file
echo "Finished loading sample batches." 2>&1 | tee -a $log_file