Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Mastodon
  3. mysterious tootctl media remove task

mysterious tootctl media remove task

Scheduled Pinned Locked Moved Mastodon
20 Posts 5 Posters 3.3k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nebulonN Offline
    nebulonN Offline
    nebulon
    Staff
    wrote on last edited by
    #2

    So this is the app package cleanup task for cached media https://git.cloudron.io/cloudron/mastodon-app/-/blob/master/cleanup.sh

    I have recently set the default to 2 days as this is only a cache (avatar/media/cards/..) and caused a lot of small files, which slowed down backups a lot.

    You can adjust this though: https://docs.cloudron.io/apps/mastodon/#cache-retention-days

    Tbh I am not quite sure how the content retention settings in the UI are used, maybe those are just the defaults for the tootctl cleanup tasks? Maybe our cleanup task is not required anymore even.

    1 Reply Last reply
    0
    • nichu42N Offline
      nichu42N Offline
      nichu42
      wrote on last edited by nichu42
      #3

      Ah, thanks for the clarification. I don't know why it uses so much CPU and it takes so long.

      I have the following entries in my daily cronjob:

      /app/code/bin/tootctl media remove --days 7
      /app/code/bin/tootctl statuses remove --days 7
      /app/code/bin/tootctl media remove-orphans
      /app/code/bin/tootctl preview-cards remove --days 7
      /app/code/bin/tootctl cache clear
      /app/code/bin/tootctl accounts prune
      /app/code/bin/tootctl media remove --prune-profiles --days 7
      

      Is there a way I can disable the package cleanup task completely? I don't think I need it. The settings above did a good job for me.

      Matrix: @nichu42:blueplanet.social

      1 Reply Last reply
      0
      • nebulonN Offline
        nebulonN Offline
        nebulon
        Staff
        wrote on last edited by
        #4

        Are you referring to a custom cron job you have set there? As the package does contain this script https://git.cloudron.io/cloudron/mastodon-app/-/blob/master/cleanup.sh

        nichu42N 1 Reply Last reply
        0
        • nebulonN nebulon

          Are you referring to a custom cron job you have set there? As the package does contain this script https://git.cloudron.io/cloudron/mastodon-app/-/blob/master/cleanup.sh

          nichu42N Offline
          nichu42N Offline
          nichu42
          wrote on last edited by
          #5

          @nebulon
          Yes, I have created a custom cronjob for this a few months ago when backups started to take forever due to all the small files (as you mentioned as well).
          It starts at 23:15 each night.

          Matrix: @nichu42:blueplanet.social

          1 Reply Last reply
          0
          • nebulonN Offline
            nebulonN Offline
            nebulon
            Staff
            wrote on last edited by
            #6

            In this case you can probably remove your custom cron job and rely on the one from the package. I have to investigate which ones from your script we should add to our cleanup script then.

            1 Reply Last reply
            0
            • nebulonN Offline
              nebulonN Offline
              nebulon
              Staff
              wrote on last edited by
              #7

              I have added missing ones from your script to the one in the package. Only accounts prune does not seem to exist anymore.

              This will then be part of the next package release.

              1 Reply Last reply
              3
              • nichu42N Offline
                nichu42N Offline
                nichu42
                wrote on last edited by
                #8

                It's not in the CLI docs yet, but 'accounts prune' does work and is quite helpful.
                https://github.com/mastodon/mastodon/pull/18397

                If you add this too, I can indeed remove my custom cronjob. But please also add an option to control when the cleanup.sh is launched. 11:00 is not a good time for my server, I'd like to keep the cleanup processes running in the night, just before the scheduled backup.

                Matrix: @nichu42:blueplanet.social

                1 Reply Last reply
                1
                • doodlemania2D Offline
                  doodlemania2D Offline
                  doodlemania2
                  App Dev
                  wrote on last edited by
                  #9

                  that's a great add, thanks for doing that @nebulon !

                  1 Reply Last reply
                  0
                  • nebulonN Offline
                    nebulonN Offline
                    nebulon
                    Staff
                    wrote on last edited by
                    #10

                    Thanks for the hint, I have included the account pruning

                    1 Reply Last reply
                    2
                    • nichu42N Offline
                      nichu42N Offline
                      nichu42
                      wrote on last edited by
                      #11

                      I've changed the setting to 7 days and the runtime of the built-in cleanup script is now down to 1 hour / day, which is absolutely fine. I'd still like to schedule it for the night, though.

                      Matrix: @nichu42:blueplanet.social

                      1 Reply Last reply
                      0
                      • nebulonN Offline
                        nebulonN Offline
                        nebulon
                        Staff
                        wrote on last edited by
                        #12

                        since it doesn't matter much I will then put the package cron from current 11 11 * * * to 11 01 * * *

                        1 Reply Last reply
                        1
                        • J Offline
                          J Offline
                          johannesjom
                          wrote on last edited by
                          #13

                          This script also puts quite a lot of load on our server. Is it really still necessary to use it yourself instead of the clean-up scripts provided by Mastodon?

                          girishG 1 Reply Last reply
                          1
                          • J johannesjom

                            This script also puts quite a lot of load on our server. Is it really still necessary to use it yourself instead of the clean-up scripts provided by Mastodon?

                            girishG Offline
                            girishG Offline
                            girish
                            Staff
                            wrote on last edited by
                            #14

                            @johannesjom which script are you referring to?

                            1 Reply Last reply
                            0
                            • nebulonN Offline
                              nebulonN Offline
                              nebulon
                              Staff
                              wrote on last edited by
                              #15

                              The package cron job for cleanup does use the upstream cleanup jobs. You can also change the retention days via https://docs.cloudron.io/apps/mastodon/#cache-retention-days

                              J 1 Reply Last reply
                              1
                              • nebulonN nebulon

                                The package cron job for cleanup does use the upstream cleanup jobs. You can also change the retention days via https://docs.cloudron.io/apps/mastodon/#cache-retention-days

                                J Offline
                                J Offline
                                johannesjom
                                wrote on last edited by
                                #16

                                @nebulon i dit asume that /admin/settings/content_retention has other scripts behind, cause there you can change the days because you can set different days for different things there.

                                nichu42N 1 Reply Last reply
                                0
                                • J johannesjom

                                  @nebulon i dit asume that /admin/settings/content_retention has other scripts behind, cause there you can change the days because you can set different days for different things there.

                                  nichu42N Offline
                                  nichu42N Offline
                                  nichu42
                                  wrote on last edited by
                                  #17

                                  @johannesjom It seems that the internal routine does remove some content, but as most of the admin settings and options, it's very poorly documented, if at all. I have no idea which tootctl commands exactly are triggered, or when that happens.
                                  I guess you have to go through lots of Issues and PRs to find out about this. As long as it's unclear, I think it's a good idea to have an additional cleanup script (such as the one provided by Cloudron) to make sure that the installation doesn't take too much space.

                                  Matrix: @nichu42:blueplanet.social

                                  1 Reply Last reply
                                  0
                                  • nebulonN Offline
                                    nebulonN Offline
                                    nebulon
                                    Staff
                                    wrote on last edited by
                                    #18

                                    at least last time I had checked the code, the UI settings were actually different from what they are now, but it is still not clear to me who and where those cleanup tasks are run or if the settings are just the default for the cli tasks we run in the package via cron.

                                    1 Reply Last reply
                                    0
                                    • nichu42N Offline
                                      nichu42N Offline
                                      nichu42
                                      wrote on last edited by
                                      #19

                                      @nebulon: This seems to be a quite comprehensive and well documented clean-up script: https://codeberg.org/Fedimins/mastodon-maintenance-tasks
                                      Maybe you want to ship it with Cloudron?

                                      Matrix: @nichu42:blueplanet.social

                                      1 Reply Last reply
                                      1
                                      • girishG Offline
                                        girishG Offline
                                        girish
                                        Staff
                                        wrote on last edited by
                                        #20

                                        @nichu42 good link...

                                        I had a look at https://codeberg.org/Fedimins/mastodon-maintenance-tasks . I couldn't run the script directly because there's a bunch of hardcoded paths in it. Found some commands that maybe we can incorporate. Many of the commands are already in our cleanup script.

                                        • tootctl accounts cull --concurrency xx - removes remote accounts that no longer exist
                                        • tootctl accounts prune - remove accounts that have never interacted locally
                                        • tootctl domains purge <domain> - https://docs.joinmastodon.org/admin/tootctl/#domains-purge
                                        • run_tootctl statuses remove --days=xx - https://docs.joinmastodon.org/admin/tootctl/#statuses-remove
                                        • tootctl media remove --days <days> --concurrency <concurrency> - https://docs.joinmastodon.org/admin/tootctl/#media-remove
                                        1 Reply Last reply
                                        3
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        • Login

                                        • Don't have an account? Register

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Bookmarks
                                        • Search