Skip to content
Docs

User guide

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

CommandWhat it doesDefault threshold
file.cleanGarbageFilesCleans up attachments not linked to any post10 days
file.cleanThumbnailsDeletes old thumbnails90 days
file.cleanEmptyDirsRemoves empty folders-
module.cleanMiscLogsDeletes old logs30 days
ncenterlite.cleanNotificationsRemoves 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.cleanNotifications

Notes

  • 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.log to confirm they work correctly.
  • This assumes a Linux server. On a Windows server, register the same commands with Task Scheduler.