3 # DO NOT EDIT - This file is being maintained by Chef
6 # Cleanup archive directory
9 for fl in <%= @streaming_clients %>; do
10 lastupdate=`wget -O - -q https://${fl}.openstreetmap.org/last_update.php`
11 if [[ "$?" != "0" ]]; then
15 epoch=`date +%s -d "$lastupdate"`
16 if [[ "$epoch" -lt "$oldest" ]]; then
23 if [[ "$oldest" != "0" ]]; then
25 timeago=$(( ( $now - $oldest ) / 60 + 180 ))
26 if [[ "$timeago" -lt "180" ]]; then
27 echo "Oldest is in the future, something is wrong."
29 if [[ "$timeago" -le "720" ]]; then
33 find -L <%= @archive_dir %> -mmin +$timeago -print0 | xargs -0r rm
37 diskfree=`df --output=pcent <%= @archive_dir %> | tail -n 1 | sed s:[^0-9.]::g`
39 if [[ "$diskfree" -lt 10 ]]; then
40 echo "WAL archives running out of space. Stopping updates."
41 touch <%= @update_stop_file %>