summaryrefslogtreecommitdiff
path: root/custom/uucp-mediaserver/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'custom/uucp-mediaserver/scripts')
-rwxr-xr-xcustom/uucp-mediaserver/scripts/queue45
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)
44suffix=${base##*.} 44suffix=${base##*.}
45 45
46force=0 46force=0
47if [[ "$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
54fi
55
56noCall=false 47noCall=false
57if [[ "$1" == "-r" ]]; then 48prepend=false
58 shift 49while getopts "frp" OPT; do
59 noCall=true 50 case OPT in
60fi 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
70done
61 71
62for f (${@}); do 72for 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
72done 87done
73 88
74offset=1 89offset=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