set correct logs permissions

This commit is contained in:
Roger Pàmies Fabra 2023-07-26 00:43:43 +02:00
parent b672496f67
commit d6900f9e35
1 changed files with 2 additions and 4 deletions

View File

@ -12,7 +12,8 @@ extension=${file##*.}
base=$(basename "${file%.*}") base=$(basename "${file%.*}")
# create remote folder to store logs if not exist # create remote folder to store logs if not exist
ssh $ES7_LOGS_SERVER_SSH "mkdir -p $REMOTE_PATH" # \$ allow read remote variable value
ssh $ES7_LOGS_SERVER_SSH "sudo mkdir -p $REMOTE_PATH && sudo chown -R \$(whoami): $REMOTE_PATH"
# Copy local logfile to remote destination # Copy local logfile to remote destination
scp $1 "$ES7_LOGS_SERVER_SSH:$REMOTE_PATH" scp $1 "$ES7_LOGS_SERVER_SSH:$REMOTE_PATH"
@ -31,7 +32,4 @@ if [ $extension != "txt" ]; then
ssh $ES7_LOGS_SERVER_SSH "mv $REMOTE_PATH$file $REMOTE_PATH$base.txt" ssh $ES7_LOGS_SERVER_SSH "mv $REMOTE_PATH$file $REMOTE_PATH$base.txt"
fi fi
# set correct owner of webserver files
ssh $ES7_LOGS_SERVER_SSH "sudo chown -R www-data: $REMOTE_PATH"
echo "${PUBLIC_LOG_URL}${base}.txt" echo "${PUBLIC_LOG_URL}${base}.txt"