diff options
author | nachoparker <nacho@ownyourbits.com> | 2019-05-11 20:10:21 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2019-05-11 20:14:19 +0300 |
commit | d9384817c2a14f0889d30bebb89e40a6cb78217c (patch) | |
tree | 74ca4e9ad40be3619962af35f78b1b85ad1593d3 /bin/ncp | |
parent | 758908128a0837304f54e58846b3e3ae4bb29cb0 (diff) |
nc-scan-auto: recursive and home-only optionsv1.12.3
Signed-off-by: nachoparker <nacho@ownyourbits.com>
Diffstat (limited to 'bin/ncp')
-rw-r--r-- | bin/ncp/CONFIG/nc-scan-auto.sh | 11 | ||||
-rw-r--r-- | bin/ncp/TOOLS/nc-scan.sh | 27 |
2 files changed, 27 insertions, 11 deletions
diff --git a/bin/ncp/CONFIG/nc-scan-auto.sh b/bin/ncp/CONFIG/nc-scan-auto.sh index 9236b033..1445d7fc 100644 --- a/bin/ncp/CONFIG/nc-scan-auto.sh +++ b/bin/ncp/CONFIG/nc-scan-auto.sh @@ -32,17 +32,20 @@ configure() [[ $hour == 0 ]] && hour="*" || { hour="*/$hour" mins="15"; } fi + [[ "$RECURSIVE" == no ]] && local recursive=--shallow + [[ "$NONEXTERNAL" == yes ]] && local non_external=--home-only + cat > /usr/local/bin/ncp-scan-auto <<EOF #!/bin/bash ( echo -e "\n[ nc-scan-auto ]" - [[ "$PATH1" != "" ]] && /usr/local/bin/ncc files:scan -n -v -p "$PATH1" - [[ "$PATH2" != "" ]] && /usr/local/bin/ncc files:scan -n -v -p "$PATH2" - [[ "$PATH3" != "" ]] && /usr/local/bin/ncc files:scan -n -v -p "$PATH3" + [[ "$PATH1" != "" ]] && /usr/local/bin/ncc files:scan $recursive $non_external -n -v -p "$PATH1" + [[ "$PATH2" != "" ]] && /usr/local/bin/ncc files:scan $recursive $non_external -n -v -p "$PATH2" + [[ "$PATH3" != "" ]] && /usr/local/bin/ncc files:scan $recursive $non_external -n -v -p "$PATH3" - [[ "${PATH1}${PATH2}${PATH3}" == "" ]] && /usr/local/bin/ncc files:scan -n -v --all + [[ "${PATH1}${PATH2}${PATH3}" == "" ]] && /usr/local/bin/ncc files:scan $recursive $non_external -n -v --all ) 2>&1 >>/var/log/ncp.log EOF diff --git a/bin/ncp/TOOLS/nc-scan.sh b/bin/ncp/TOOLS/nc-scan.sh index 394bb53c..219c016e 100644 --- a/bin/ncp/TOOLS/nc-scan.sh +++ b/bin/ncp/TOOLS/nc-scan.sh @@ -9,8 +9,8 @@ # -install() -{ +install() +{ cat > /usr/local/bin/ncp-scan <<'EOF' #!/bin/bash ncc files:scan -n -v --all @@ -18,21 +18,34 @@ EOF chmod +x /usr/local/bin/ncp-scan } -configure() +configure() { + local ret=0 + [[ "$RECURSIVE" == no ]] && local recursive=--shallow [[ "$NONEXTERNAL" == yes ]] && local non_external=--home-only - [[ "$PATH1" != "" ]] && \ + [[ "$PATH1" != "" ]] && { ncc files:scan -n -v $recursive $non_external -p "$PATH1" + [[ $? -ne 0 ]] && ret=1 + } - [[ "$PATH2" != "" ]] && \ + [[ "$PATH2" != "" ]] && { ncc files:scan -n -v $recursive $non_external -p "$PATH2" + [[ $? -ne 0 ]] && ret=1 + } - [[ "$PATH3" != "" ]] && \ + [[ "$PATH3" != "" ]] && { ncc files:scan -n -v $recursive $non_external -p "$PATH3" + [[ $? -ne 0 ]] && ret=1 + } + + [[ "${PATH1}${PATH2}${PATH3}" == "" ]] && { + ncc files:scan -n -v $recursive $non_external --all + [[ $? -ne 0 ]] && ret=1 + } - [[ "${PATH1}${PATH2}${PATH3}" == "" ]] && ncc files:scan -n -v --all + return ${ret} } # License |