Skipping processed files
This commit is contained in:
34
pdt.sh
34
pdt.sh
@@ -1,17 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ -f /var/www/html/storage/focode/processed_files.txt]]
|
||||||
|
then
|
||||||
|
readarray -t processed_files < /var/www/html/storage/focode/processed_files.txt
|
||||||
|
fi
|
||||||
|
|
||||||
readarray -t files < /var/www/html/storage/focode/file_list_temp.txt
|
readarray -t files < /var/www/html/storage/focode/file_list_temp.txt
|
||||||
|
|
||||||
for file in "${files[@]}"
|
for file in "${files[@]}"
|
||||||
do
|
do
|
||||||
output=$(php compress.php process "$file")
|
for processed_file in "${processed_files[@]}"
|
||||||
if [[ $output -gt 0 ]]
|
do
|
||||||
then
|
if [[ "$file" == "$processed_file" ]]
|
||||||
echo "ERROR! Exiting the program"
|
then
|
||||||
echo "Processed file: $file - $output" | tee -a "/var/log/pdterr$(date +%d%m%Y).log"
|
echo "Skipping already processed file: $file"
|
||||||
echo "Log saved to /var/log/pdterr$(date +%d%m%Y).log"
|
continue
|
||||||
exit 1
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Processed file: $file - $output"
|
output=$(php compress.php process "$file")
|
||||||
|
echo "$processed_file" >> /var/www/html/storage/focode/processed_files.txt
|
||||||
|
|
||||||
|
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"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
Reference in New Issue
Block a user