{"id":2105,"date":"2018-09-12T05:35:31","date_gmt":"2018-09-11T20:35:31","guid":{"rendered":"http:\/\/matoken.org\/blog\/?p=2105"},"modified":"2018-09-12T05:35:31","modified_gmt":"2018-09-11T20:35:31","slug":"automatic-cleaning-of-trash-can-with-autotrash","status":"publish","type":"post","link":"https:\/\/matoken.org\/blog\/2018\/09\/12\/automatic-cleaning-of-trash-can-with-autotrash\/","title":{"rendered":"autotrash \u3067\u30b4\u30df\u7bb1\u3092\u81ea\u52d5\u6e05\u6383"},"content":{"rendered":"<div id=\"__asciidoctor-preview-1__\" class=\"paragraph\">\n<p>\u30b4\u30df\u7bb1\u306f\u4fbf\u5229\u3067\u3059\u304c\u3069\u3093\u3069\u3093\u6e9c\u307e\u3063\u3066\u3044\u304f\u306e\u3067\u5b9a\u671f\u7684\u306b\u6368\u3066\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\uff0e\u6c17\u304c\u5411\u3044\u305f\u3068\u304d\u306b\u30b4\u30df\u7bb1\u3092\u7a7a\u306b\u3059\u308b\u306e\u3067\u3082\u3044\u3044\u306e\u3067\u3059\u304c\u305d\u308c\u3060\u30681\u6708\u524d\u306b\u30b4\u30df\u7bb1\u306b\u5165\u308c\u3066\u78ba\u5b9f\u306b\u30b4\u30df\u3067\u3042\u308d\u3046\u30d5\u30a1\u30a4\u30eb\u3082\u3055\u3063\u304d\u30b4\u30df\u7bb1\u306b\u5165\u308c\u305f\u3082\u3057\u304b\u3057\u305f\u3089\u8aa4\u3063\u3066\u524a\u9664\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3082\u4e00\u7dd2\u306b\u6d88\u3059\u3053\u3068\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u5fc3\u914d\u3067\u3059\uff0e<br \/>\nautotrash\u3092\u4f7f\u3046\u3068\u30b4\u30df\u7bb1\u306b\u5165\u308c\u305f\u65e5\u6570\u3084\u30d5\u30a1\u30a4\u30eb\u540d\uff0c\u7a7a\u304d\u5bb9\u91cf\u304c\u4f55GB\u3088\u308a\u5c11\u306a\u304f\u306a\u3063\u305f\u306a\u3069\u306e\u69d8\u3005\u306a\u6761\u4ef6\u306b\u3088\u308a\u30b4\u30df\u7bb1\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff0ecrontab\u306b\u767b\u9332\u3057\u3066\u304a\u304f\u3068\u81ea\u52d5\u5316\u3082\u3067\u304d\u3066\u304a\u85a6\u3081\u3067\u3059\uff0e<\/p>\n<\/div>\n<div id=\"__asciidoctor-preview-2__\" class=\"ulist\">\n<ul>\n<li>\n<p><a href=\"https:\/\/bneijt.nl\/pr\/autotrash\/\">AutoTrash: Automatically purge your GNOME trash<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/bneijt\/autotrash\">GitHub &#8211; bneijt\/autotrash: Tool to automatically purge old trashed files<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<div id=\"__asciidoctor-preview-3__\" class=\"paragraph\">\n<p>\u203b\u4ee5\u4e0b\u306fman\u306eexample\u3067\u65e5\u672c\u8a9e\u90e8\u5206\u306f\u9593\u9055\u3063\u3066\u3044\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093 &#8211;dry-run \u3068 &#8211;verbose \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u3066\u52d5\u4f5c\u78ba\u8a8d\u3092\u3057\u305f\u4e0a\u3067\u4f7f\u3046\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\uff0e<\/p>\n<\/div>\n<div id=\"__asciidoctor-preview-4__\" class=\"listingblock\">\n<div class=\"title\">30\u65e5\u4ee5\u4e0a\u7d4c\u904e\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664<\/div>\n<div class=\"content\">\n<pre>autotrash -d 30\r\n          Purge any file that has been in the trash for more then 30 days.<\/pre>\n<\/div>\n<\/div>\n<div id=\"__asciidoctor-preview-5__\" class=\"listingblock\">\n<div class=\"title\">\u30b4\u30df\u7bb1\u306e\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306e\u7a7a\u304d\u5bb9\u91cf\u304c1024MB(1GB)\u4ee5\u4e0b\u306b\u306a\u308b\u3088\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\uff0e\u524a\u9664\u3059\u308b\u5834\u540830\u65e5\u4ee5\u4e0a\u7d4c\u904e\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u5bfe\u8c61?<\/div>\n<div class=\"content\">\n<pre>autotrash --max-free 1024 -d 30\r\n          Only purge files from the trash if there is less than 1GB of space left on the trash filesystem. If so, only trash files that are older than 30 days.<\/pre>\n<\/div>\n<\/div>\n<div id=\"__asciidoctor-preview-6__\" class=\"listingblock\">\n<div class=\"title\">\u30b4\u30df\u7bb1\u306e\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306e\u7a7a\u304d\u5bb9\u91cf\u304c2048MB(2GB)\u4ee5\u4e0b\u306b\u306a\u308b\u307e\u3067\u53e4\u3044\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u524a\u9664\u3059\u308b?<\/div>\n<div class=\"content\">\n<pre>autotrash --min-free 2048\r\n          Purge files from trash, oldest first, till there is at least 2GB of space on the trash filesystem. There is no restriction on how old trashed files are.<\/pre>\n<\/div>\n<\/div>\n<div id=\"__asciidoctor-preview-7__\" class=\"listingblock\">\n<div class=\"title\">\u30b4\u30df\u7bb1\u306e\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306e\u7a7a\u304d\u5bb9\u91cf\u304c2048MB(2GB)\u4ee5\u4e0b\u306b\u306a\u308b\u307e\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3059\u308b\uff0e\u524a\u9664\u3059\u308b\u5834\u5408\u306f\u307e\u305a&#8221;*.bak&#8221;\u3092\u524a\u9664\u3057\u3066\u6b21\u306b&#8221;\\*.avi&#8221;\u305d\u306e\u5f8c\u306f\u53e4\u3044\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u524a\u9664\u3059\u308b?<\/div>\n<div class=\"content\">\n<pre>autotrash --min-free 2048 -D '.*\\.bak' -D '.*\\.avi'\r\n          Purge files from trash till there is at least 2GB of space on the trash filesystem. If we need to remove files, make sure we remove *.bak files first, then\r\n          all *.avi files and after that the oldest to the newest. There is no restriction on how old trashed files can get. Please note that '.*\\.bak' and '.*\\.avi'\r\n          are regular expressions and not glob patterns. Given that they are regular expressions, using -D '.*\\.(png|gif|jpg|jpeg)' will match images with any of the\r\n          given extensions.<\/pre>\n<\/div>\n<\/div>\n<div id=\"__asciidoctor-preview-8__\" class=\"listingblock\">\n<div class=\"title\">\u30b4\u30df\u7bb1\u306e\u5bb9\u91cf\u304c4000MB\u306b\u306a\u308b\u307e\u3067\u306f\u4f55\u3082\u3057\u306a\u3044\uff0c\u305d\u308c\u4ee5\u4e0a\u306e\u5834\u5408\u306f30\u65e5\u4ee5\u4e0a\u7d4c\u904e\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3057\uff0c\u30b4\u30df\u7bb1\u306e\u5bb9\u91cf\u304c2048MB\u4ee5\u4e0b\u306b\u306a\u308b\u307e\u3067\u53e4\u3044\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u524a\u9664\u3059\u308b?<\/div>\n<div class=\"content\">\n<pre>autotrash --max-free 4000 --min-free 2048 -d 30\r\n          Start  reading  the  trash  if there is less than 4000MB of free space, then start keeping an eye on. At that point, remove files older than 30 days and if\r\n          there is less than 2GB of free space after that remove even newer files.<\/pre>\n<\/div>\n<\/div>\n<div id=\"__asciidoctor-preview-9__\" class=\"paragraph\">\n<p>\u79c1\u306f\u5358\u7d14\u306b\u30b4\u30df\u7bb1\u306b\u5165\u308c\u306633\u65e5\u7d4c\u3063\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\uff0e<br \/>\n\u3053\u306e\u4f8b\u3067\u306f\u6bce\u65e502:08\u306b\u512a\u5148\u5ea6\u3092\u4e0b\u3052\u3066\u5b9f\u884c\u3057\u3066\u3044\u307e\u3059\uff0evixie-cron\u306e\u5834\u5408\u3000@daily \u3067\u3082\u3044\u3044\u3057\uff0c @reboot \u3067\u30b7\u30b9\u30c6\u30e0\u8d77\u52d5\u6642\u306b\u51e6\u7406\u3068\u304b\u3067\u3082\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff0e\u8a73\u7d30\u306f man 5 crontab \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\uff0e<\/p>\n<\/div>\n<div id=\"__asciidoctor-preview-10__\" class=\"listingblock\">\n<div class=\"content\">\n<pre>$ crontab -l|grep autotrash\r\n8 2 * * *       nice -n 19 ionice -c 3 autotrash -d 33<\/pre>\n<\/div>\n<\/div>\n<div id=\"__asciidoctor-preview-11__\" class=\"paragraph\">\n<p>\u305f\u3060\uff0c\u3053\u308c\u306f\u30b4\u30df\u7bb1\u3092\u4f7f\u3063\u3066\u3044\u308b\u30e6\u30fc\u30b6\u6bce\u306b\u8a2d\u5b9a\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u304c\u3061\u3087\u3063\u3068\u9762\u5012\u3067\u3059\uff0e\u4e00\u4eba\u3067\u4f7f\u3063\u3066\u3044\u308b\u30b7\u30b9\u30c6\u30e0\u306a\u3089\u3044\u3044\u306e\u3067\u3059\u304c\uff0c\u5229\u7528\u8005\u304c1000\u4eba\u3060\u3068 \/etc\/crontab \u306b1000\u884c\u66f8\u304f\u306a\u3069\u3057\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\uff0e<br \/>\nautotrash 0.2.1 \u3067\u306f -t \u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u5168\u30e6\u30fc\u30b6\u306e\u30c1\u30a7\u30c3\u30af\u304c\u51fa\u6765\u308b\u3088\u3046\u3067\u3059\uff0e(\u624b\u5143\u306e\u74b0\u5883\u3067\u306f 0.1.5 \u306a\u306e\u3067\u672a\u78ba\u8a8d)<\/p>\n<\/div>\n<div id=\"__asciidoctor-preview-12__\" class=\"listingblock\">\n<div class=\"title\"><a href=\"https:\/\/bneijt.nl\/pr\/autotrash\/\">AutoTrash: Automatically purge your GNOME trash<\/a>\u3088\u308a<\/div>\n<div class=\"content\">\n<pre>You can also make autotrash process all user trash directories (not just in your home directory) by adding this crontab entry:\r\n\r\n@daily \/usr\/bin\/autotrash -td 30<\/pre>\n<\/div>\n<\/div>\n<div id=\"__asciidoctor-preview-13__\" class=\"listingblock\">\n<div class=\"title\">\u74b0\u5883<\/div>\n<div class=\"content\">\n<pre>$ dpkg-query -W autotrash\r\nautotrash       0.1.5-1.1\r\n$ lsb_release -d\r\nDescription:    Debian GNU\/Linux unstable (sid)\r\n$ uname -m\r\nx86_64<\/pre>\n<\/div>\n<\/div>\n<div id=\"__asciidoctor-preview-14__\" class=\"paragraph\">\n<p>\uff03sid\u3060\u3051\u3069upstream\u306b\u8ffd\u5f93\u3057\u3066\u306a\u3044\u3067\u3059\u306d&gt;&lt;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u30b4\u30df\u7bb1\u306f\u4fbf\u5229\u3067\u3059\u304c\u3069\u3093\u3069\u3093\u6e9c\u307e\u3063\u3066\u3044\u304f\u306e\u3067\u5b9a\u671f\u7684\u306b\u6368\u3066\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\uff0e\u6c17\u304c\u5411\u3044\u305f\u3068\u304d\u306b\u30b4\u30df\u7bb1\u3092\u7a7a\u306b\u3059\u308b\u306e\u3067\u3082\u3044\u3044\u306e\u3067\u3059\u304c\u305d\u308c\u3060\u30681\u6708\u524d\u306b\u30b4\u30df\u7bb1\u306b\u5165\u308c\u3066\u78ba\u5b9f\u306b\u30b4\u30df\u3067\u3042\u308d\u3046\u30d5\u30a1\u30a4\u30eb\u3082\u3055\u3063\u304d\u30b4\u30df\u7bb1\u306b\u5165\u308c\u305f\u3082\u3057\u304b\u3057\u305f\u3089\u8aa4\u3063\u3066\u524a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[7,6,199],"tags":[394,395],"class_list":["post-2105","post","type-post","status-publish","format-standard","hentry","category-debian-linux","category-linux","category-sid","tag-autotrash","tag-trash-can"],"_links":{"self":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/2105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/comments?post=2105"}],"version-history":[{"count":0,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/2105\/revisions"}],"wp:attachment":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/media?parent=2105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/categories?post=2105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/tags?post=2105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}