blob: c5198a253eb135b06d5025b76504146a0f22edfc (
plain)
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
38
39
40
41
|
#!@zsh@/bin/zsh
delta_t=20
interval=3600
staggerFile=~/.rss-stagger
[[ "${FLOCKER}" != "$0" ]] && exec env FLOCKER="$0" flock -x "${staggerFile}" "$0" "$@" || :
typeset -A feeds
r2e list | while read num junk name junk; do
num=${num%:}
feeds[${num}]=${name}
done
max=$(($#feeds))
num=$(((max * delta_t) / interval))
[[ $num -lt 1 ]] && num=1
now=$(cat ${staggerFile} || echo 0)
now=$((now % max))
typeset -a run
run=()
typeset -a names
names=()
n=0
for i in $(seq $((now + 1)) $((now + num + 1))); do
n=$((i % max))
run+=$n
names+=$feeds[${n}]
done
echo $n >! ${staggerFile}
print ${names}
exec @rss2email@/bin/r2e run $run
|