2023-11-15 13:54:37 +01:00
|
|
|
#!/usr/bin/env bash
|
2023-11-22 14:32:35 +01:00
|
|
|
set -eu -o pipefail
|
2023-11-15 13:54:37 +01:00
|
|
|
|
|
|
|
# As long as there is the file `stay-alive` at host `yodaNas`,
|
|
|
|
# this loop blocks/waits.
|
|
|
|
while :; do
|
2023-11-22 14:32:35 +01:00
|
|
|
result="$(ssh yodaNas 'ls stay-alive 2>&1')" || :
|
2023-11-15 13:54:37 +01:00
|
|
|
case "${result}" in
|
2023-11-23 12:44:23 +01:00
|
|
|
*'No such file or directory')
|
2023-11-15 13:54:37 +01:00
|
|
|
break
|
|
|
|
;;
|
2023-11-23 12:44:23 +01:00
|
|
|
'stay-alive')
|
2023-11-15 13:54:37 +01:00
|
|
|
printf '%s\n' 'Delaying suspend due to stay-alive file.'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
printf '%s\n' 'Delaying suspend due to SSH connectivity problems.'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
sleep 10s
|
|
|
|
done
|