chamilo-lms icon indicating copy to clipboard operation
chamilo-lms copied to clipboard

Cron should cleanup app/cache and archives but how?

Open jderriks opened this issue 10 years ago • 8 comments

When you do a cleanup from the admin page it tells you to do this from cron. But what cleanup.php should be called? Or what folders to delete? Archive alone is not enough. App/cache gets big too.

Expected behavior / Resultado esperado / Résultat attendu

-Automatic cleanup of archive files and app/cache folder. -Clear description of how to setup crontab

Actual behavior / Resultado real / Résultat réel

-Admin has to visit admin page and manualy click "cleanup archive" -There is a cron/cleanup file that looks like it's old and not usable: https://github.com/chamilo/chamilo-lms/blob/e79f9e19ad755e95172d5f6ad6826f623af0fecc/main/cron/cleanup.php

Steps to reproduce / Pasos para reproducir / Étapes pour reproduire

Goto ....main/admin/archive_cleanup.php page and read that you should use cron.

jderriks avatar Nov 01 '16 21:11 jderriks

https://github.com/chamilo/chamilo-lms/blob/1.11.x/main/admin/archive_cleanup.php The cleanup does something more that just cleanup... It fixes your web folder?

Answer to the cron question: the folder formerly known as archive is now called app/cache. Tell cron to clean it every night with "rm -rf app/cache/*" and it will save gigabytes of diskspace (and backup space if you didn't exclude app/cache from backups). It might cause irritation to an unfortunate user that requests an export or download at the precise cleanup-moment but we can allways blame Murphy for that.

Steps to create crontab: crontab -e add lines: #min hour date mon weekday command #example: cleanup at 03:07 every morning an keep a log of the size. 7 3 * * * (cd /web/yourchamilo/; du -sh app/cache; rm -rf app/cache/*) >> $HOME/cronjobs.log

jderriks avatar Dec 04 '16 21:12 jderriks

archive_cleanup.php also copies files from:

/app/Resources/public to /web

jmontoyaa avatar Dec 05 '16 08:12 jmontoyaa

Translations should be updated here:

http://translate.chamilo.org/

jmontoyaa avatar Dec 05 '16 08:12 jmontoyaa

Should copy /app/Resources/public to /web be in cron too? Why is it in the cleanup?

Comment on my cron job: unfortunately I cannot sudo to the apache user (that is owner of the files). So a wget - callable version of cleanup with some simple password in the url would be nice. That is the Moodle approach. There are also online cron-like services that can call the URL if you don't have access to the web server. Even uptimerobot.com could be used for that.

jderriks avatar Dec 05 '16 15:12 jderriks

The copy of /app/Resources/public to /web Exists just to refresh the chamilo css files.

jmontoyaa avatar Dec 07 '16 13:12 jmontoyaa

The copy of /app/Resources/public to /web was asked by me, otherwise there was also a manual process to make sure the CSS was updated.

ywarnier avatar Dec 20 '16 17:12 ywarnier

And yes, a web-callable script with a password would be nice, but this should be part of another report, otherwise we'll continue developing this one and never be able to close it.

ywarnier avatar Dec 20 '16 17:12 ywarnier

This is not a big issue and can be closed. And delete https://github.com/chamilo/chamilo-lms/blob/e79f9e19ad755e95172d5f6ad6826f623af0fecc/main/cron/cleanup.php while closing it :-)

jderriks avatar Dec 21 '16 15:12 jderriks