Compare commits
No commits in common. "fba7d5d0fd907c917cdc65360c8c33b79d52a8ff" and "1d8ef909681b2bb37e5ecd4284b0bdcf825e56ec" have entirely different histories.
fba7d5d0fd
...
1d8ef90968
91
atom
91
atom
@ -231,8 +231,8 @@ do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
unset deleted
|
deleted=0
|
||||||
unset removed
|
removed=0
|
||||||
echo 'BEGIN TRANSACTION;' >&3
|
echo 'BEGIN TRANSACTION;' >&3
|
||||||
for id in ${!removefile[@]}
|
for id in ${!removefile[@]}
|
||||||
do
|
do
|
||||||
@ -256,9 +256,9 @@ do
|
|||||||
done
|
done
|
||||||
echo 'COMMIT;' >&3
|
echo 'COMMIT;' >&3
|
||||||
(( cron )) || echo -n $'\r'
|
(( cron )) || echo -n $'\r'
|
||||||
echo -n "${deleted+$deleted files deleted${removed:+, }}${removed:+$removed removed from database}"
|
echo -n "Suppressed $deleted files, $removed removed from database"
|
||||||
(( cron )) || echo -ne "\033[K"
|
(( cron )) || echo -ne "\033[K"
|
||||||
(( deleted || removed )) && echo
|
echo
|
||||||
unset removecount deleted removed removefile
|
unset removecount deleted removed removefile
|
||||||
|
|
||||||
updateTags
|
updateTags
|
||||||
@ -272,8 +272,7 @@ do
|
|||||||
Update destination_files last_change 0 \
|
Update destination_files last_change 0 \
|
||||||
<<<"destination_id = $forcedestid"
|
<<<"destination_id = $forcedestid"
|
||||||
else
|
else
|
||||||
echo "Full rebuild of destination $forcedest was requested," \
|
echo "Destination $forcedest does not exist!" >&2
|
||||||
"but it does not exist!" >&2
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -442,7 +441,7 @@ do
|
|||||||
decodefiles+=("$line::AtOM:SQL:Sep::")
|
decodefiles+=("$line::AtOM:SQL:Sep::")
|
||||||
read -u4 line
|
read -u4 line
|
||||||
done
|
done
|
||||||
(( cron )) || echo -n $'Creating tasks...\033[K'
|
(( cron )) || echo -n 'Creating tasks... '
|
||||||
|
|
||||||
(( textunidecodeneeded )) && ascii
|
(( textunidecodeneeded )) && ascii
|
||||||
|
|
||||||
@ -548,11 +547,8 @@ do
|
|||||||
tmpfile
|
tmpfile
|
||||||
done
|
done
|
||||||
echo 'COMMIT;' >&3
|
echo 'COMMIT;' >&3
|
||||||
(( cron )) || echo -n $'\r\033[K'
|
(( cron )) || echo -n $'\r'
|
||||||
(( count )) \
|
echo "Created ${count:-0} tasks for $filecount files ${togo:+($togo left) }(${copies:-0} immediate copies)"
|
||||||
&& echo "Created $count tasks for $filecount files \
|
|
||||||
${togo:+($togo left) } \
|
|
||||||
${copies:+($copies immediate copies)}"
|
|
||||||
|
|
||||||
# remove perl unicode to ascii coprocess
|
# remove perl unicode to ascii coprocess
|
||||||
(( textunidecodeneeded )) && eval exec "${toascii[1]}>&-"
|
(( textunidecodeneeded )) && eval exec "${toascii[1]}>&-"
|
||||||
@ -567,7 +563,7 @@ remaining=$taskcount
|
|||||||
failed=0
|
failed=0
|
||||||
echo 'BEGIN TRANSACTION;' >&3
|
echo 'BEGIN TRANSACTION;' >&3
|
||||||
committime=$EPOCHSECONDS
|
committime=$EPOCHSECONDS
|
||||||
while (( remaining || ${#workers[@]} ))
|
while (( (remaining || ${#workers[@]}) && ! quit ))
|
||||||
do
|
do
|
||||||
timestamp=$EPOCHSECONDS
|
timestamp=$EPOCHSECONDS
|
||||||
if (( $timestamp - committime >= 60 ))
|
if (( $timestamp - committime >= 60 ))
|
||||||
@ -581,15 +577,16 @@ do
|
|||||||
then
|
then
|
||||||
concurrency="$fixed_workers"
|
concurrency="$fixed_workers"
|
||||||
else
|
else
|
||||||
if (( timestamp - concurrencychange >= loadinterval ))
|
if [ -z "$quit" ] \
|
||||||
|
&& (( ! pause )) \
|
||||||
|
&& (( timestamp - concurrencychange >= loadinterval ))
|
||||||
then
|
then
|
||||||
if (( concurrency > 1 || allow_zero_running )) \
|
if (( concurrency > 1 )) \
|
||||||
&& (( load > maxload && concurrency ))
|
&& (( load > maxload ))
|
||||||
then
|
then
|
||||||
concurrencychange=$timestamp
|
concurrencychange=$timestamp
|
||||||
(( --concurrency ))
|
(( --concurrency ))
|
||||||
elif (( load < maxload )) \
|
elif (( load < maxload )) && (( active > concurrency - 1 ))
|
||||||
&& (( active > concurrency - 1 ))
|
|
||||||
then
|
then
|
||||||
concurrencychange=$timestamp
|
concurrencychange=$timestamp
|
||||||
(( ++concurrency ))
|
(( ++concurrency ))
|
||||||
@ -598,11 +595,16 @@ do
|
|||||||
fi
|
fi
|
||||||
checkworkers
|
checkworkers
|
||||||
cleaner
|
cleaner
|
||||||
master
|
(( pause )) || master
|
||||||
if (( ran - failed ))
|
if (( ran - failed ))
|
||||||
then
|
then
|
||||||
currenttime=$timestamp
|
currenttime=$timestamp
|
||||||
(( runtime = currenttime - starttime ))
|
if (( pause ))
|
||||||
|
then
|
||||||
|
(( runtime = pausestart - starttime - pausedtime ))
|
||||||
|
else
|
||||||
|
(( runtime = currenttime - starttime - pausedtime ))
|
||||||
|
fi
|
||||||
avgduration=$((
|
avgduration=$((
|
||||||
( runtime * 1000)
|
( runtime * 1000)
|
||||||
/
|
/
|
||||||
@ -638,7 +640,11 @@ do
|
|||||||
fmtprogress="T:%${#taskcount}i/%i (F:%i) %3i%%"
|
fmtprogress="T:%${#taskcount}i/%i (F:%i) %3i%%"
|
||||||
fmttime='%2id %2ih%02im%02is (A:%4.1fs/task)'
|
fmttime='%2id %2ih%02im%02is (A:%4.1fs/task)'
|
||||||
eta="ETA:$(
|
eta="ETA:$(
|
||||||
printf "%(%c)T" "$(( currenttime + secsremaining ))"
|
date -d "${days:-0} days
|
||||||
|
${hours:-0} hours
|
||||||
|
${minutes:-0} minutes
|
||||||
|
${seconds:-0} seconds" \
|
||||||
|
+'%d/%m %H:%M:%S'
|
||||||
)"
|
)"
|
||||||
(( cron )) || printf \
|
(( cron )) || printf \
|
||||||
"\r$fmtload $fmtworkers $fmtprogress $fmttime $eta\033[K"\
|
"\r$fmtload $fmtworkers $fmtprogress $fmttime $eta\033[K"\
|
||||||
@ -655,7 +661,7 @@ do
|
|||||||
${minutes:-0} \
|
${minutes:-0} \
|
||||||
${seconds:-0} \
|
${seconds:-0} \
|
||||||
${avgdsec:-0}.${avgdmsec:-0}
|
${avgdsec:-0}.${avgdmsec:-0}
|
||||||
if ! (( concurrency )) && ! (( cron ))
|
if (( pause ))
|
||||||
then
|
then
|
||||||
if (( active ))
|
if (( active ))
|
||||||
then
|
then
|
||||||
@ -670,25 +676,22 @@ unset count
|
|||||||
|
|
||||||
endtime=$EPOCHSECONDS
|
endtime=$EPOCHSECONDS
|
||||||
|
|
||||||
(( elapsedseconds = endtime - starttime ))
|
(( elapsedseconds = endtime - starttime - pausedtime ))
|
||||||
(( days =
|
(( days =
|
||||||
elapsedseconds
|
elapsedseconds
|
||||||
/
|
/
|
||||||
( 24*60*60 )
|
( 24*60*60 )
|
||||||
)) || true
|
)) || true
|
||||||
(( days )) || unset days
|
|
||||||
(( hours =
|
(( hours =
|
||||||
( elapsedseconds - ( days*24*60*60 ) )
|
( elapsedseconds - ( days*24*60*60 ) )
|
||||||
/
|
/
|
||||||
( 60*60 )
|
( 60*60 )
|
||||||
)) || true
|
)) || true
|
||||||
(( days && hours )) || unset hours
|
|
||||||
(( minutes =
|
(( minutes =
|
||||||
( elapsedseconds - ( ( days*24 + hours ) *60*60 ) )
|
( elapsedseconds - ( ( days*24 + hours ) *60*60 ) )
|
||||||
/
|
/
|
||||||
60
|
60
|
||||||
)) || true
|
)) || true
|
||||||
(( days && hours && minutes )) || unset minutes
|
|
||||||
(( seconds =
|
(( seconds =
|
||||||
elapsedseconds
|
elapsedseconds
|
||||||
-
|
-
|
||||||
@ -696,15 +699,10 @@ endtime=$EPOCHSECONDS
|
|||||||
)) || true
|
)) || true
|
||||||
|
|
||||||
(( cron )) || echo -n $'\r'
|
(( cron )) || echo -n $'\r'
|
||||||
(( ran )) \
|
echo -n "Ran ${ran:=0} tasks, $failed of which failed, in $days" \
|
||||||
&& echo -n "Ran $ran tasks${failed:+, $failed of which failed,} \
|
"days, $hours hours, $minutes minutes and $seconds seconds."
|
||||||
in ${days:+$days days,} \
|
|
||||||
${hours:+$hours hours,} \
|
|
||||||
${minutes:+$minutes minutes and} \
|
|
||||||
$seconds seconds."
|
|
||||||
(( cron )) || echo -en "\033[K"
|
(( cron )) || echo -en "\033[K"
|
||||||
(( ran )) && echo
|
echo
|
||||||
|
|
||||||
if (( failed ))
|
if (( failed ))
|
||||||
then
|
then
|
||||||
echo $'\nFailed tasks:\n'
|
echo $'\nFailed tasks:\n'
|
||||||
@ -787,10 +785,17 @@ then
|
|||||||
echo "${line%%::AtOM:SQL:Sep::*}"
|
echo "${line%%::AtOM:SQL:Sep::*}"
|
||||||
line="${line#*::AtOM:SQL:Sep::}"
|
line="${line#*::AtOM:SQL:Sep::}"
|
||||||
line="${line//::AtOM:SQL:Sep::/ }"
|
line="${line//::AtOM:SQL:Sep::/ }"
|
||||||
echo $'\t'"${line/+( )$/}"$'\n'
|
echo $'\t'"${line/+( )$/}"
|
||||||
|
echo
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$quit" ]
|
||||||
|
then
|
||||||
|
closeDatabase
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
for destination in "${!destinationpath[@]}"
|
for destination in "${!destinationpath[@]}"
|
||||||
do
|
do
|
||||||
echo '
|
echo '
|
||||||
@ -904,7 +909,7 @@ do
|
|||||||
"${destinationfat32compat["$destination"]}," \
|
"${destinationfat32compat["$destination"]}," \
|
||||||
" ascii=" \
|
" ascii=" \
|
||||||
"${destinationascii["$destination"]}" \
|
"${destinationascii["$destination"]}" \
|
||||||
"WHERE id=$destfileid;" \
|
"WHERE id=$destfileid;" \
|
||||||
>&3
|
>&3
|
||||||
if (( commit ))
|
if (( commit ))
|
||||||
then
|
then
|
||||||
@ -917,10 +922,9 @@ do
|
|||||||
(( textunidecodeneeded )) && eval exec "${toascii[1]}>&-"
|
(( textunidecodeneeded )) && eval exec "${toascii[1]}>&-"
|
||||||
echo 'COMMIT;' >&3
|
echo 'COMMIT;' >&3
|
||||||
(( cron )) || echo -n $'\r'
|
(( cron )) || echo -n $'\r'
|
||||||
(( changedcount )) \
|
echo -n "$destination: Renamed ${changedcount:-0} files"
|
||||||
&& echo -n "$destination: Renamed $changedcount files"
|
|
||||||
(( cron )) || echo -en "\033[K"
|
(( cron )) || echo -en "\033[K"
|
||||||
(( changedcount )) && echo
|
echo
|
||||||
fi
|
fi
|
||||||
unset count changedcount renamefiles
|
unset count changedcount renamefiles
|
||||||
done
|
done
|
||||||
@ -941,7 +945,7 @@ echo '
|
|||||||
SELECT "AtOM:NoMoreFiles";
|
SELECT "AtOM:NoMoreFiles";
|
||||||
' >&3
|
' >&3
|
||||||
|
|
||||||
(( cron )) || echo -n 'Removing obsolete files...'$'\033[K'
|
(( cron )) || echo -n 'Removing obsolete files... '
|
||||||
lines=()
|
lines=()
|
||||||
read -u4 line
|
read -u4 line
|
||||||
while [[ $line != AtOM:NoMoreFiles ]]
|
while [[ $line != AtOM:NoMoreFiles ]]
|
||||||
@ -968,12 +972,11 @@ do
|
|||||||
done
|
done
|
||||||
echo 'COMMIT;' >&3
|
echo 'COMMIT;' >&3
|
||||||
(( cron )) || echo -n $'\r'
|
(( cron )) || echo -n $'\r'
|
||||||
(( count )) \
|
echo -n "Removed ${count:-0} obsolete files."
|
||||||
&& echo -n "Removed $count obsolete files."
|
|
||||||
(( cron )) || echo -en "\033[K"
|
(( cron )) || echo -en "\033[K"
|
||||||
(( count )) && echo
|
echo
|
||||||
|
|
||||||
(( debug )) && echo "Purging empty directories..."
|
echo "Purging empty directories."
|
||||||
for path in "${destinationpath[@]}"
|
for path in "${destinationpath[@]}"
|
||||||
do
|
do
|
||||||
find "$path" -type d -empty -delete
|
find "$path" -type d -empty -delete
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
copyFiles_action() {
|
copyFiles_action() {
|
||||||
(( cron )) || echo -n $'Copying files...\033[K'
|
(( cron )) || echo -n "Copying files... "
|
||||||
echo '
|
echo '
|
||||||
SELECT
|
SELECT
|
||||||
source_files.filename,
|
source_files.filename,
|
||||||
@ -79,29 +79,15 @@ copyFiles_action() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if cp -a --reflink=always \
|
if cp -al "$sourcepath/$sourcefilename" "$destdir" 2>/dev/null\
|
||||||
"$sourcepath/$sourcefilename" \
|
|| cp -a "$sourcepath/$sourcefilename" "$destdir"
|
||||||
"$destdir" \
|
|
||||||
2>/dev/null \
|
|
||||||
|| cp -al \
|
|
||||||
"$sourcepath/$sourcefilename" \
|
|
||||||
"$destdir" \
|
|
||||||
2>/dev/null \
|
|
||||||
|| cp -a \
|
|
||||||
"$sourcepath/$sourcefilename" \
|
|
||||||
"$destdir"
|
|
||||||
then
|
then
|
||||||
Update destination_files \
|
Update destination_files \
|
||||||
filename \
|
filename "$destdir/${sourcefilename##*/}"\
|
||||||
"$destdir/${sourcefilename##*/}"\
|
rename_pattern "${destinationrenamepath[$destination]}/${destinationrename[$destination]}"\
|
||||||
rename_pattern \
|
fat32compat ${destinationfat32compat["$destination"]}\
|
||||||
"${destinationrenamepath[$destination]}/${destinationrename[$destination]}"\
|
ascii ${destinationascii["$destination"]}\
|
||||||
fat32compat \
|
last_change $lastchange \
|
||||||
${destinationfat32compat["$destination"]}\
|
|
||||||
ascii \
|
|
||||||
${destinationascii["$destination"]}\
|
|
||||||
last_change \
|
|
||||||
$lastchange \
|
|
||||||
<<-EOWhere
|
<<-EOWhere
|
||||||
id = $destfileid
|
id = $destfileid
|
||||||
EOWhere
|
EOWhere
|
||||||
@ -112,12 +98,12 @@ copyFiles_action() {
|
|||||||
if (( count ))
|
if (( count ))
|
||||||
then
|
then
|
||||||
(( cron )) || echo -n $'\r'
|
(( cron )) || echo -n $'\r'
|
||||||
echo -n "Copied ${done:-0} of $count" \
|
echo -n "Copied ${done:-0} of $count" \
|
||||||
"files${postponed+ ($postponed postponed)}."
|
"files${postponed+ ($postponed postponed)}."
|
||||||
(( cron )) || echo -en "\033[K"
|
(( cron )) || echo -en "\033[K"
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
(( cron )) || echo -n $'\r\033[K'
|
(( cron )) || echo -e "\rNothing to copy.\033[K"
|
||||||
fi
|
fi
|
||||||
unset count done
|
unset count done
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,10 +67,6 @@ getFiles() {
|
|||||||
)
|
)
|
||||||
echo 'COMMIT;' >&3
|
echo 'COMMIT;' >&3
|
||||||
(( cron )) || echo -n $'\r'
|
(( cron )) || echo -n $'\r'
|
||||||
if (( count ))
|
echo "${count:-0} files found, ${new:=0} new or changed."$'\033[K'
|
||||||
then
|
|
||||||
echo "$count files found${new:+, $new new or changed}." \
|
|
||||||
$'\033[K'
|
|
||||||
fi
|
|
||||||
unset count
|
unset count
|
||||||
}
|
}
|
||||||
|
|||||||
@ -206,8 +206,8 @@ echo '
|
|||||||
done
|
done
|
||||||
echo 'COMMIT;' >&3
|
echo 'COMMIT;' >&3
|
||||||
(( cron )) || echo -n $'\r'
|
(( cron )) || echo -n $'\r'
|
||||||
(( count )) && echo -n "Read tags from $count files."
|
echo -n "Read tags from ${count:-0} files."
|
||||||
(( cron )) || echo -n $'\033[K'
|
(( cron )) || echo -ne "\033[K"
|
||||||
(( count )) && echo
|
echo
|
||||||
unset count tagfiles
|
unset count tagfiles
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user