diff options
Diffstat (limited to 'custom/uucp-mediaserver')
-rwxr-xr-x | custom/uucp-mediaserver/scripts/queue | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/custom/uucp-mediaserver/scripts/queue b/custom/uucp-mediaserver/scripts/queue index 0ad653ff..ea294a6d 100755 --- a/custom/uucp-mediaserver/scripts/queue +++ b/custom/uucp-mediaserver/scripts/queue | |||
@@ -44,20 +44,30 @@ base=$(basename $0) | |||
44 | suffix=${base##*.} | 44 | suffix=${base##*.} |
45 | 45 | ||
46 | force=0 | 46 | force=0 |
47 | if [[ "$1" == "-f" ]]; then | ||
48 | shift | ||
49 | force=1 | ||
50 | if [[ -n "$1" && "$1" -eq "$1" ]] 2>/dev/null; then | ||
51 | force="$1" | ||
52 | shift | ||
53 | fi | ||
54 | fi | ||
55 | |||
56 | noCall=false | 47 | noCall=false |
57 | if [[ "$1" == "-r" ]]; then | 48 | prepend=false |
58 | shift | 49 | while getopts "frp" OPT; do |
59 | noCall=true | 50 | case OPT in |
60 | fi | 51 | r) |
52 | noCall=true | ||
53 | ;; | ||
54 | f) | ||
55 | if [[ ${@:$OPTIND} =~ ^[0-9]+$ ]];then | ||
56 | force=${@:$OPTIND} | ||
57 | OPTIND=$((OPTIND+1)) | ||
58 | else | ||
59 | force=1 | ||
60 | fi | ||
61 | ;; | ||
62 | p) | ||
63 | prepend=true | ||
64 | ;; | ||
65 | \?) | ||
66 | echo "Invalid option -${OPTARG}" >&2 | ||
67 | exit 2 | ||
68 | ;; | ||
69 | esac | ||
70 | done | ||
61 | 71 | ||
62 | for f (${@}); do | 72 | for f (${@}); do |
63 | f=$(readlink -f ${f}) | 73 | f=$(readlink -f ${f}) |
@@ -68,7 +78,12 @@ for f (${@}); do | |||
68 | if uustat | grep -q ${f:t}; then | 78 | if uustat | grep -q ${f:t}; then |
69 | printf "‘%s’ is already in uucp queue\n" ${f:t} | warn | 79 | printf "‘%s’ is already in uucp queue\n" ${f:t} | warn |
70 | fi | 80 | fi |
71 | print -r ${f} >> @queueDir@/${suffix}.queue | 81 | |
82 | if ${prepend}; then | ||
83 | mv =(print -r ${f}; cat @queueDir@/${suffix}.queue) @queueDir@/${suffix}.queue | ||
84 | else | ||
85 | print -r ${f} >> @queueDir@/${suffix}.queue | ||
86 | fi | ||
72 | done | 87 | done |
73 | 88 | ||
74 | offset=1 | 89 | offset=1 |
@@ -85,7 +100,7 @@ while true; do | |||
85 | if [[ -n "${file}" ]]; then | 100 | if [[ -n "${file}" ]]; then |
86 | printf "‘%s’ does not exist, skipping\n" "${file}" >&2 | 101 | printf "‘%s’ does not exist, skipping\n" "${file}" >&2 |
87 | printf "Subject: Missing file in %s\n\n%s" $logTag ${file} \ | 102 | printf "Subject: Missing file in %s\n\n%s" $logTag ${file} \ |
88 | | sendmail gkleen \ | 103 | | sendmail uucp \ |
89 | && echo "Sent mail." | 104 | && echo "Sent mail." |
90 | fi | 105 | fi |
91 | advance | 106 | advance |