blob: bbccd1dd7cbe1103a5d2e8d2f11fc78d22705bbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# Copyright (C) 2024-2026 Maria Lisina
# Copyright (C) 2024-2026 Danil Lisin
# SPDX-License-Identifier: Apache-2.0
if [[ -n "${no_clear}" ]]
then
return
fi
for file in $(find "${cache}" -follow -type f)
do
if ! mkdir "${file%.*}.lock"
then
continue
fi
file_ctime=$(strftime %s)
file_mtime=$(stat +mtime "${file}")
if [[ $((file_ctime - file_mtime)) -gt $((cache_time + 20)) ]]
then
rm -f "${file}"
fi
rmdir "${file%.*}.lock"
done
|