Files
pdt/pdt.sh
2026-01-16 12:24:09 +01:00

24 lines
756 B
Bash

#!/bin/bash
readarray -t files < /var/www/html/storage/focode/file_list_temp.txt
for file in "${files[@]}"
do
if [[ -f "/var/www/html/storage/focode/processed_files.txt" && $(grep -c "$file" "/var/www/html/storage/focode/processed_files.txt") -gt 0 ]]
then
echo "Skipping already processed file: $file"
continue
fi
output=$(php compress.php process "$file")
if [[ $output -gt 0 ]]
then
echo "ERROR! Exiting the program"
echo "Processed file: $file - $output" | tee -a "/var/log/pdterr$(date +%d%m%Y).log"
echo "Log saved to /var/log/pdterr$(date +%d%m%Y).log"
exit 1
fi
echo "Processed file: $file - $output" | tee -a /var/www/html/storage/focode/processed_files.txt
done