added control of the already processed files
This commit is contained in:
15
pdt.sh
15
pdt.sh
@@ -1,25 +1,17 @@
|
|||||||
#!/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
|
||||||
for processed_file in "${processed_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 ]]
|
||||||
if [[ "$file" == "$processed_file" ]]
|
|
||||||
then
|
then
|
||||||
echo "Skipping already processed file: $file"
|
echo "Skipping already processed file: $file"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
output=$(php compress.php process "$file")
|
output=$(php compress.php process "$file")
|
||||||
echo "$processed_file" >> /var/www/html/storage/focode/processed_files.txt
|
|
||||||
|
|
||||||
if [[ $output -gt 0 ]]
|
if [[ $output -gt 0 ]]
|
||||||
then
|
then
|
||||||
echo "ERROR! Exiting the program"
|
echo "ERROR! Exiting the program"
|
||||||
@@ -28,6 +20,5 @@ do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Processed file: $file - $output"
|
echo "Processed file: $file - $output" | tee -a /var/www/html/storage/focode/processed_files.txt
|
||||||
done
|
|
||||||
done
|
done
|
||||||
Reference in New Issue
Block a user