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
  • Brite
  • 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. Jirafeau
  3. Deleting Old Files

Deleting Old Files

Scheduled Pinned Locked Moved Jirafeau
6 Posts 2 Posters 52 Views 2 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.
  • visampV Offline
    visampV Offline
    visamp
    wrote last edited by
    #1

    I wanted to make sure that this file path was correct for Jirafeau. See the screenshot below for the crontab item I have added per the documentation here: https://gitlab.com/jirafeau/Jirafeau#how-can-i-automatize-the-cleaning-of-old-expired-files. Does this look correct (file path)?

    2a1ed338-8684-4990-94ac-4346292d684c-image.png

    Also, is there a way to ensure that any files that are uploaded ONLY stay for say 7 days? Meaning, the option for files to stay longer or shorter or permanently are disabled...

    Thanks,
    Matt

    1 Reply Last reply
    0
    • jamesJ Online
      jamesJ Online
      james
      Staff
      wrote last edited by
      #2

      Hello @visamp
      The @jirafeau app should run these jobs automatically.
      The app includes https://git.cloudron.io/packages/jirafeau-app/-/blob/master/cron.sh

      #!/bin/bash
      
      set -eu
      
      cd /app/code
      
      echo "=> Run cron tasks"
      /usr/local/bin/gosu www-data:www-data php /app/code/admin.php clean_expired
      /usr/local/bin/gosu www-data:www-data php /app/code/admin.php clean_async
      
      

      Which is scheduled by the CloudronManifest.json cron.

      source: https://git.cloudron.io/packages/jirafeau-app/-/blob/master/CloudronManifest.json?ref_type=heads#L26-L31

          "scheduler": {
            "housekeeping": {
              "schedule": "12 * * * *",
              "command": "/app/pkg/cron.sh"
            }
          }
      

      Did this not work?


      @visamp said in Deleting Old Files:

      Also, is there a way to ensure that any files that are uploaded ONLY stay for say 7 days? Meaning, the option for files to stay longer or shorter or permanently are disabled...

      This is not documented very well. I will add this to our Cloudron docs if my following finding return to be true.
      According to the official docs from the docker part: https://gitlab.com/jirafeau/Jirafeau/-/blob/master/docker/README.md?ref_type=heads

      AVAILABILITY_DEFAULT: setup which availability shows by default.
      

      But, we don't use these docker env vars and what is allowed to set there is also not documented.

      I've dug into the source code and found this - https://gitlab.com/jirafeau/Jirafeau/-/blob/master/lib/functions.php?ref_type=heads#L1927-L1960:

      function jirafeau_datestr_to_int($time_str)
      {
          $time = time();
          switch ($time_str) {
              case 'minute':
                  $time += JIRAFEAU_MINUTE;
                  break;
              case 'hour':
                  $time += JIRAFEAU_HOUR;
                  break;
              case 'day':
                  $time += JIRAFEAU_DAY;
                  break;
              case 'week':
                  $time += JIRAFEAU_WEEK;
                  break;
              case 'fortnight':
                  $time += JIRAFEAU_FORTNIGHT;
                  break;
              case 'month':
                  $time += JIRAFEAU_MONTH;
                  break;
              case 'quarter':
                  $time += JIRAFEAU_QUARTER;
                  break;
              case 'year':
                  $time += JIRAFEAU_YEAR;
                  break;
              default:
                  $time = JIRAFEAU_INFINITY;
                  break;
          }
          return $time;
      }
      

      So, setting the following config in /app/data/custom.php:

      $cfg['availability_default'] = 'week';
      

      restarted the app and now:

      e826e2c5-27b6-4b03-9c09-31733717de1d-image.png
      There is no longer the option to select a time period, so I assume, it worked, and the default is always week.

      Maybe you @visamp can test this and report back.

      1 Reply Last reply
      1
      • jamesJ Online
        jamesJ Online
        james
        Staff
        wrote last edited by
        #3

        I just noticed, this is only the default selector so not a hard limit.
        Will research a little more.

        1 Reply Last reply
        1
        • jamesJ Online
          jamesJ Online
          james
          Staff
          wrote last edited by james
          #4

          Found it.
          In the /app/data/custom.php you need to set:

          //  optional default selector
          $cfg['availability_default'] = 'week';
          
          // only set 'week' to true
          $cfg['availabilities'] = array(
              'minute' => false,
              'hour' => false,
              'day' => false,
              'week' => true,
              'fortnight' => false,
              'month' => false,
              'quarter' => false,
              'year' => false,
              'none' => false
          );
          

          an app restart is not even needed after changing option in the /app/data/custom.php

          1 Reply Last reply
          2
          • visampV Offline
            visampV Offline
            visamp
            wrote last edited by
            #5

            This is so above and beyond!!! Thank you so much for the support - I have made the adjustment and have set the variable so that it defaults to a week. I also did not know that there were cronjobs already setup to account for this. PERFECT!!!!

            1 Reply Last reply
            1
            • jamesJ Online
              jamesJ Online
              james
              Staff
              wrote last edited by
              #6

              Always happy to help.
              I also added this to the Cloudron docs.

              1 Reply Last reply
              1
              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