summaryrefslogtreecommitdiff
path: root/debian/sessionclean
blob: 0f11e1d05a27276e09c2e0e14b5636cd7ad55205 (plain)
1
2
3
4
5
6
7
#!/bin/sh

# first find all used files and touch them (hope it's not massive amount of files)
lsof -w -l +d "${1}" | awk -- '{ if (NR > 1) { print $9; } }' | xargs -i touch -c {}

# find all files older then maxlifetime
find "${1}" -depth -mindepth 1 -maxdepth 1 -type f -ignore_readdir_race -cmin +${2} -delete