#!/bin/sh mkdir -p "$main_basedir/archives/" statuses_file_archive_after_time=$(jj -i "$main_basedir"/config.json statuses_file_archive_after_time) unixtime_offset=$(expr $(date "+%s") - $statuses_file_archive_after_time) for i in "$main_basedir"/all_statuses/$instance/*; do old_check=$(date +'%s' -r "$i"/*.json) if [ $old_check -lt $unixtime_offset ]; then zip -r -m -u -X "$main_basedir"/archives/$instance.zip $i echo "[Archiver] Olded status $i $(date -d "@$old_check") moved to archive" fi done find "$main_basedir"/all_statuses/$instance -type d -empty -exec rmdir {} + # Fix not removed empty folder after move (zip bug)