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


Navigation

    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    SOLVED Cron for Backups

    Grav CMS
    3
    5
    37
    Loading More Posts
    • 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.
    • T
      timbo last edited by

      Hey Folks,
      Grav needs a Cronjob to do scheduled backups. I tried by using several "how-tos" already in the docs of other apps, in this forum, and from the original Grav-Documentation, but i can't manage to get it working.
      Maybe you know a way of getting it to work?

      What i did so far:
      Created a manual crontab file in app/data/ + restart
      Then run the bin/grav scheduler -i command which outputs, everything would be fine.
      But after another restart, Grav still has no Cronjob available and outputs this:
      Bildschirmfoto 2021-01-23 um 10.46.35.png

      Appreciate every help 🙂

      girish 1 Reply Last reply Reply Quote 0
      • jimcavoli
        jimcavoli App Dev last edited by

        This would typically be done via the scheduler add-on in the app packaging. It wasn't implemented initially since Cloudron does its own automatic backups of the site. Is there an additional advantage to having these backups as opposed to just using the built-in Cloudron ones? I believe you can still manually create one if needed for portability between installations

        1 Reply Last reply Reply Quote 0
        • girish
          girish Staff @timbo last edited by

          @timbo The scheduler is already configured, so the backups should probably already be autogenerated if you enable the default-site-backup. The scheduler is run every 5 minutes by the package. Grav doesn't realize it's configured properly because I guess it's looking into crontab or something but Cloudron packages do not use cron.

              "scheduler": {
                "grav_scheduler": {
                  "schedule": "*/5 * * * *",
                  "command": "sudo -u www-data -E -- /app/code/bin/grav scheduler"
                }
          
          1 Reply Last reply Reply Quote 0
          • girish
            girish Staff last edited by

            I added a custom scheduler job like this:

            41a1381b-5ae5-47f3-8157-7fc59506f525-image.png

            I can then see the ls cron job is run:

            root@933fe4a5-e1c6-4c14-a14b-c9ff02d6c559:/app/code/logs# tail -f ls-cron.txt 
            lrwxrwxrwx  1 root     root       14 Jan 22 17:32 logs -> /run/grav/logs
            -rw-rw-r--  1 www-data www-data   72 Jan 21 22:19 now.json
            -rw-rw-r--  1 www-data www-data  274 Jan 21 22:19 robots.txt
            drwxrwxr-x 10 www-data www-data 4.0K Jan 21 22:19 system
            drwxrwxr-x  8 www-data www-data 4.0K Jan 21 22:19 tests
            lrwxrwxrwx  1 root     root       13 Jan 22 17:32 tmp -> /run/grav/tmp
            lrwxrwxrwx  1 root     root       14 Jan 22 17:32 user -> /app/data/user
            drwxrwxr-x  8 www-data www-data 4.0K Jan 21 22:19 user.original
            drwxr-xr-x 31 www-data www-data 4.0K Jan 22 17:32 vendor
            drwxrwxr-x  2 www-data www-data 4.0K Jan 21 22:19 webserver-configs
            
            
            1 Reply Last reply Reply Quote 0
            • T
              timbo last edited by

              Oh yes, i just realized that it actually is already setup. Sorry - works fine 🙂

              1 Reply Last reply Reply Quote 1
              • First post
                Last post