mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 12:42:50 +00:00
28 lines
420 B
Bash
28 lines
420 B
Bash
#!/bin/bash
|
|
set -e
|
|
set -u
|
|
set -o pipefail
|
|
|
|
function check-and-download() {
|
|
remote_file=$1
|
|
local_file=$2
|
|
timeout -s INT 300 wget ${WGET_OPTIONS:-} -q -N -O ${local_file} ${remote_file} || {
|
|
rm ${local_file}
|
|
return 1
|
|
}
|
|
return
|
|
}
|
|
|
|
function dir-not-empty() {
|
|
local dir=$1
|
|
[[ ! -d "$dir" ]] && return 1
|
|
nfiles=$(ls -a "$dir" | wc -l)
|
|
if (( ${nfiles} > 2 )); then
|
|
return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
LOADED_HELPERS="yes"
|
|
|