trilium-next-{desktop,server}: init at 0.90.12 (#356930)
[NixPkgs.git] / nixos / modules / services / networking / hylafax / faxq-wait.sh
blob1826aa30e6275b2dfbc1827278d52fbbd71d1fbc
1 #! @runtimeShell@ -e
3 # skip this if there are no modems at all
4 if ! stat -t "@spoolAreaPath@"/etc/config.* >/dev/null 2>&1
5 then
6 exit 0
7 fi
9 echo "faxq started, waiting for modem(s) to initialize..."
11 for i in `seq @timeoutSec@0 -1 0` # gracefully timeout
13 sleep 0.1
14 # done if status files exist, but don't mention initialization
15 if \
16 stat -t "@spoolAreaPath@"/status/* >/dev/null 2>&1 \
17 && \
18 ! grep --silent --ignore-case 'initializing server' \
19 "@spoolAreaPath@"/status/*
20 then
21 echo "modem(s) apparently ready"
22 exit 0
24 # if i reached 0, modems probably failed to initialize
25 if test $i -eq 0
26 then
27 echo "warning: modem initialization timed out"
29 done