Empty trash every 30 minutes

Я хочу, чтобы моя корзина очищалась каждые 30 минут.

Я установил Autotrash, но в нем указаны дни возраста.

Есть ли альтернатива?

задан 12 August 2020 в 04:22

1 ответ

You can create a simple script file and set it up in cron to run every 30 minutes.

Create a new file with your script. You can put it anyplace. In this example, we will put the script in your home directory's ~/.config

sudo nano ~/.config/emptytrash30.sh

Add the following:

find /home/yourname/.local/share/Trash/expunged/ -type f -exec rm {} \;
find /home/yourname/.local/share/Trash/files/ -type f -exec rm {} \;
find /home/yourname/.local/share/Trash/info/ -type f -exec rm {} \;

Save CTRL + O, and exit CTRL + X.

Make the script executable:

chmod +x ~/.config/emptytrash30.sh

Now set up cron to run the script every 30 minutes:

crontab -e

Choose an editor if you've never used cron before.

Add the following at the end:

*/30 * * * * /home/yourname/.config/emptytrash30.sh

This tells cron to execute your script every 30 minutes of every hour on every day, on every day of the week, on every day of the month.

Save CTRL + O, and exit CTRL + X.

ответ дан 21 August 2020 в 08:01

Другие вопросы по тегам:

Похожие вопросы: