I’d like to have all files from specific folders deleted from a non-disposable qube, under certain circumstances -
Ideally - When all windows of a qube are closed
Can live with - When the qube is restarted
It seems like the standard practice is to use named disposables. I’m finding this cumbersome to configure and in some cases I may want files in certain folders to persist across qube restarts.
My primary use case is to delete files from the $HOME/Downloads and $HOME/QubesIncoming folders.
I’ve imagined an inelegant solution that uses cron but feel the timing might not be great. So I’m wondering if there might be a way to trigger the delete process when all windows of a qube are closed or at least when the qube is restarted.
There is already a mechanism to clean up empty directories in
QubesIncoming - you could leverage this by editing the service in /usr/lib/qubes/init/misc-post-stop.sh
But then you will have to watch for any updates that affect that
service.
Better would be to use a simple service that runs using ExecStop. You could either put this in the template and
enable it where needed, or implement it in the qube and enable the
service there.