Scheduled jobs (Crontab)
As you run a site, unnecessary data builds up, such as info on withdrawn members, thumbnails of deleted photos, and old notifications. Setting up scheduled jobs (Crontab) cleans these up automatically, protecting your disk space and performance.
This is only for your own server (with SSH access). On web hosting, you can register the same commands only if your host provides a cron feature.
Command format
php index.php 모듈명.스크립트명 [변수]Run it with the PHP CLI from the installation path. Calling it through a web address (web cron) is not supported.
Provided cleanup scripts
| Command | What it does | Default threshold |
|---|---|---|
file.cleanGarbageFiles | Cleans up attachments not linked to any post | 10 days |
file.cleanThumbnails | Deletes old thumbnails | 90 days |
file.cleanEmptyDirs | Removes empty folders | - |
module.cleanMiscLogs | Deletes old logs | 30 days |
ncenterlite.cleanNotifications | Removes old notifications | - |
crontab example
Edit with crontab -e. To avoid overload, we recommend running them one after another a few minutes apart in the early morning hours.
5 5 * * * cd /var/www/mysite && php index.php file.cleanGarbageFiles
10 5 * * * cd /var/www/mysite && php index.php file.cleanThumbnails
15 5 * * * cd /var/www/mysite && php index.php module.cleanMiscLogs
20 5 * * * cd /var/www/mysite && php index.php ncenterlite.cleanNotificationsNotes
- Run them as the same account as the web server (www-data, etc.). If you register them in root's crontab, the ownership of generated files will be wrong and the web server will not be able to access them. You can register them for that account with
crontab -e -u www-data. - After registering, check
files/cron.logto confirm they work correctly. - This assumes a Linux server. On a Windows server, register the same commands with Task Scheduler.