-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.sh
executable file
·37 lines (32 loc) · 906 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
export TOP_PID=$$
#variables
scriptDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd );
#source the function script
source "$scriptDir"/functions.sh
hash rsync ionice lsof find xattr 2>/dev/null || echo "Requirements: rsync lsof find xattr"
[ -e "$scriptDir"/settings.conf ] && source "$scriptDir"/settings.conf||FINDOPTS=(-not -path "./staticfolder/*")
while getopts "ht:a:b:" option
do
case $option in
h)
usage && exit
;;
t)
minfind="$OPTARG" #in minutes how long time files must be to be processed.
;;
a)
sourcePath="${OPTARG%/}"
;;
b)
targetPath="${OPTARG%/}"
;;
?)
usage
exit 1
;;
esac
done
[ -z "$sourcePath" ] && exit 1
moveIdleFilesInPath "$sourcePath" "$targetPath"