diff options
author | Leo Vivier <zaeph@zaeph.net> | 2022-10-23 20:25:15 +0200 |
---|---|---|
committer | Leo Vivier <zaeph@zaeph.net> | 2022-10-23 20:25:15 +0200 |
commit | 63f6ea3cc24d7c8f0de4f10f47780cf649325940 (patch) | |
tree | 32e77e1155caab336337996dfed561efebfa5d28 | |
parent | 39c08b2a9de8140e787509b68204be614a59b605 (diff) | |
download | emacsconf-wiki-63f6ea3cc24d7c8f0de4f10f47780cf649325940.tar.xz emacsconf-wiki-63f6ea3cc24d7c8f0de4f10f47780cf649325940.zip |
Minor fixups to script
-rw-r--r-- | 2022/organizers-notebook/index.org | 30 |
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 |