summaryrefslogtreecommitdiff
path: root/odin/strm
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-04-06 19:54:03 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-04-06 19:54:03 +0200
commite52e5ea5494319f158e9d9c1425b16b9986e929a (patch)
tree7330667fc281e6de00b968bd31ff7ca5e5234f41 /odin/strm
parenta29c95fe7335167cc3012dedfef2c4afbe1392c7 (diff)
downloadnixos-e52e5ea5494319f158e9d9c1425b16b9986e929a.tar
nixos-e52e5ea5494319f158e9d9c1425b16b9986e929a.tar.gz
nixos-e52e5ea5494319f158e9d9c1425b16b9986e929a.tar.bz2
nixos-e52e5ea5494319f158e9d9c1425b16b9986e929a.tar.xz
nixos-e52e5ea5494319f158e9d9c1425b16b9986e929a.zip
rss_staggered
Diffstat (limited to 'odin/strm')
-rwxr-xr-xodin/strm/rss_staggered32
1 files changed, 32 insertions, 0 deletions
diff --git a/odin/strm/rss_staggered b/odin/strm/rss_staggered
new file mode 100755
index 00000000..54bbd1a3
--- /dev/null
+++ b/odin/strm/rss_staggered
@@ -0,0 +1,32 @@
1#!@zsh@/bin/zsh
2
3delta_t=20
4interval=3600
5
6staggerFile=~/.rss-stagger
7
8[[ "${FLOCKER}" != "$0" ]] && exec env FLOCKER="$0" flock -x "${staggerFile}" "$0" "$@" || :
9
10feeds=$(@rss2email@/bin/r2e list | awk -F ':' 'END { print $1; }')
11max=$(($feeds + 1))
12num=$(((max * delta_t) / interval))
13[[ $num -lt 1 ]] && num=1
14
15now=$(cat ${staggerFile} || echo 0)
16now=$((now % max))
17
18typeset -a run
19run=()
20typeset -a names
21names=()
22
23n=0
24
25for i in $(seq $((now + 1)) $((now + num + 1))); do
26 n=$((i % max))
27 run+=$n
28done
29
30echo $n >! ${staggerFile}
31
32exec @rss2email@/bin/r2e run $run