I have a folder /home/hussam/.cache/someapp/Tempfiles-*****.
where ***** is a random string.
The application I am using is creating those files. It tries to clean them up on exit but occasionally fails if they are too small.
I already contacted the application author but no reply.
lsof correctly reports which are open and which are not. it doesn't read files from previous sessions.
So I want to create a cron job that checks for /home/hussam/.cache/someapp/files-something files and then checks if they are not in use and if so, delete them.
I can do find /home/hussam/.cache/someapp/ -name Tempfiles-*
and
[[ ! $(lsof | grep a_file) ]] && /usr/bin/rm -rf a_file.
How do I combine it all in one line so it works as a cronjob?
Thank you.
where ***** is a random string.
The application I am using is creating those files. It tries to clean them up on exit but occasionally fails if they are too small.
I already contacted the application author but no reply.
lsof correctly reports which are open and which are not. it doesn't read files from previous sessions.
So I want to create a cron job that checks for /home/hussam/.cache/someapp/files-something files and then checks if they are not in use and if so, delete them.
I can do find /home/hussam/.cache/someapp/ -name Tempfiles-*
and
[[ ! $(lsof | grep a_file) ]] && /usr/bin/rm -rf a_file.
How do I combine it all in one line so it works as a cronjob?
Thank you.