Initial Commit
This commit is contained in:
23
pgsql-log/get-logs.sh
Normal file
23
pgsql-log/get-logs.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Source and destination directories
|
||||
SRC_DIR="/var/lib/pgsql/15/data/log/"
|
||||
DEST_DIR="/usr/share/nginx/html/paad/pgsql-log/"
|
||||
|
||||
# Days of the week
|
||||
DAYS=("Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun")
|
||||
|
||||
echo "Done"
|
||||
# Iterate over each day and copy the file if it exists
|
||||
for day in "${DAYS[@]}"; do
|
||||
src_file="${SRC_DIR}postgresql-${day}.log"
|
||||
dest_file="${DEST_DIR}postgresql-${day}.log"
|
||||
|
||||
if [[ -f "$src_file" ]]; then
|
||||
sudo cp "$src_file" "$dest_file"
|
||||
echo "Copied ${src_file} to ${dest_file}"
|
||||
else
|
||||
echo "File ${src_file} not found"
|
||||
fi
|
||||
|
||||
done
|
||||
Reference in New Issue
Block a user