Cron jobs
Lufi have commands which can be used in cron jobs.
To see what commands are available:
cd /var/www/lufi && carton exec script/lufi cron
It is recommended to execute the cron tasks once a day:
- the delete IP task can be executed less than once a day. Or more. It exists for legal reasons, so you need to know when you have to delete the sender's IP addresses
- the delete expired files task is here to delete expired files. You can execute it less than once a day: if one asks for an expired file, the file is deleted. This task exists for files that are expired which no one wants to see
- the watch directory's file can be executed more than once a day if you're short on storage.
Delete IP adresses from database
To automatically delete the IP addresses of file's senders after a configurable delay:
cd /var/www/lufi && carton exec script/lufi cron cleanbdd --mode production
Delete expired files
To automatically delete files which availability delay is over (when you choose that your image will be deleted after 24h / one week / etc.)
If delete_no_longer_viewed_files
is set, the files not viewed since delete_no_longer_viewed_files
days will be deleted too.
cd /var/www/lufi && carton exec script/lufi cron cleanfiles --mode production
Please note that files are deleted 2 days after their expiration: if a download begins right before the expiration time, you don’t want to prevent the download to succeed because the cron task deleted the files. I choose 2 days as a safe delay for really big files and/or really slow Internet connections.
Watch the size of the files directory
To execute an action when the files directory is heavier than max_total_size
.
The available actions are warn
, stop-upload
and delete
:
-
warn
prints a message on the standard out (which is normally mailed to you bycron
) ; -
stop-upload
prints a message on the standard out and creates thestop-upload
file which prevents uploading and put a warn on Lutim interface ; -
DANGEROUS OPTION!!!
delete
prints a message on the standard out and delete older images until the files directory goes under quota.
If the files directory go under quota, the stop-upload
file is deleted. If you want to manually prevents uploading, create a file named stop-upload.manual
.
cd /var/www/lufi && carton exec script/lufi cron watch --mode production
Your Lufi is now fully ready!
I recommend you to read the update page, for when you'll update your lufi instance.
Back to wiki's homepage.