Cron for Backups
-
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 manualcrontab
file inapp/data/
+ restart
Then run thebin/grav scheduler -i
command which outputs, everything would be fine.
But after another restart, Grav still has no Cronjob available and outputs this:
Appreciate every help
-
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 -
@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" }
-
I added a custom scheduler job like this:
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