-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgc.sh
More file actions
executable file
·23 lines (20 loc) · 879 Bytes
/
gc.sh
File metadata and controls
executable file
·23 lines (20 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# Usage: gc.sh
#
# Deletes old intermediate files in stage-data/ that aren't needed anymore.
# The openstreetmap.org server automatically closes changesets after 24h,
# so if a changeset hasn't been modified in at least that long, we can
# safely assume that it won't change again in the future.
find stage-data/changesets/ -type f -mtime +3 -printf '%P\n' \
| cut -d '.' -f1 \
| while read changeset_id; do
echo "removing files for changeset $changeset_id"
# atomically move the split files to a temporary location before deleting
# them (prevents merge_adiffs.py being run during the deletion, which could
# result in an incomplete adiff being generated)
tmpdir=$(mktemp -d)
mv stage-data/split-adiffs/$changeset_id/ $tmpdir
rm -rf $tmpdir
# also delete the stamp file
rm stage-data/changesets/$changeset_id.adiff.md5
done