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