Skip to content
Snippets Groups Projects
Commit a1aae5c2 authored by Marc's avatar Marc
Browse files

extended error handling in download_databases_from_s3bucket.sh and cleanup of...

extended error handling in download_databases_from_s3bucket.sh and cleanup of logfile in main.py happens now if logfile is 1KB
parent d2304840
No related branches found
No related tags found
No related merge requests found
...@@ -52,7 +52,9 @@ function all_folders_in_datadir () { ...@@ -52,7 +52,9 @@ function all_folders_in_datadir () {
} }
function sync_data () { function sync_data () {
[[ -r $DATADIR && -w $DATADIR && -x $DATADIR ]] || fail "ERROR: database directory must be readable, writable and executable"
echo "Downloading databases... " echo "Downloading databases... "
cd $DATADIR cd $DATADIR
...@@ -82,7 +84,7 @@ function fail () { ...@@ -82,7 +84,7 @@ function fail () {
exit 1 exit 1
} }
[ "$#" -eq 2 ] || fail "2 arguments required, $# provided" [ "$#" -eq 2 ] || fail "ERROR: 2 arguments required, $# provided"
if [[ -e $LOGFILE ]]; then if [[ -e $LOGFILE ]]; then
test_datadir test_datadir
......
...@@ -68,7 +68,7 @@ def cleanup(execution): ...@@ -68,7 +68,7 @@ def cleanup(execution):
shutil.rmtree(execution['directory']) shutil.rmtree(execution['directory'])
logfile = execution['install_path'] + '/database_paths.log' logfile = execution['install_path'] + '/database_paths.log'
if os.stat(logfile).st_size >= 131072: if os.stat(logfile).st_size >= 1024:
cmd = "tmpfile=$(mktemp); tail {logfile} > $tmpfile; cat $tmpfile > {logfile}; rm -f $tmpfile;".format(logfile=logfile) cmd = "tmpfile=$(mktemp); tail {logfile} > $tmpfile; cat $tmpfile > {logfile}; rm -f $tmpfile;".format(logfile=logfile)
subprocess.run(cmd, shell=True) subprocess.run(cmd, shell=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment