summaryrefslogtreecommitdiffstats
path: root/2022/organizers-notebook
diff options
context:
space:
mode:
Diffstat (limited to '2022/organizers-notebook')
-rw-r--r--2022/organizers-notebook/index.org30
1 files changed, 27 insertions, 3 deletions
diff --git a/2022/organizers-notebook/index.org b/2022/organizers-notebook/index.org
index 02415adc..e9cd7912 100644
--- a/2022/organizers-notebook/index.org
+++ b/2022/organizers-notebook/index.org
@@ -3695,10 +3695,11 @@ Throw an error if ERROR is non-nil, skip otherwise."
#+begin_src sh :eval no :tangle prerecs-wait-new.sh
#!/usr/bin/env sh
+set -eu
+
sleep_duration=600
data="$(basename "$0" ".sh").data"
-touch "$data"
plural () {
if [ "$2" = 1 ] || [ "$2" = -1 ]; then
@@ -3739,6 +3740,29 @@ _sleep() {
sleep "$sleep_duration"
}
+fetch() {
+ TERM=xterm ssh orga@media.emacsconf.org -- ls -1 /srv/upload | wc -l
+}
+
+clean() {
+ rm -f "$data"
+ log "Data file has been cleaned"
+}
+
+if [ "$#" -gt 0 ]; then
+ command="$1"
+ if [ "$command" = "clean" ]; then
+ clean
+ exit 0
+ fi
+
+ if [ "$command" = "clean-start" ]; then
+ clean
+ fi
+fi
+
+touch "$data"
+
log2 "Currently waiting for prerec"
while true; do
@@ -3747,12 +3771,12 @@ while true; do
while true; do
log "Checking..."
- prerecs_number_current="$(TERM=xterm ssh orga@media.emacsconf.org -- ls -1 /srv/upload | wc -l)"
+ prerecs_number_current="$(fetch)"
diff=$((prerecs_number_current - prerecs_number_past))
if [ $diff -gt 0 ]; then
break
fi
- log "No new prerec."
+ log "No new prerec"
_sleep
done