Plesk

The /tmp directory grows very large and contains many “magick-xxxxx” files in its subdirectories

Symptoms

Cause

The specific website code and its interaction with the PHP extension imagick is generating a great number of files in the mentioned temporary directory.

The issue is not related to Plesk but, is related to ImageMagick itself, which can be confirmed in the following threads:
 
ImageMagick creates huge temporary files · Issue #395 · ImageMagick/ImageMagick · GitHub
carrierwave - imagemagick doesn't delete tmp files - Stack Overflow

Resolution

The recommended initial course of action is to review the website code and the specific portion of it that interacts with ImageMagick and generates these files in order to resolve the issue.

As a workaround, you can set up the automated removal of such temporary files related to ImageMagick by following these steps:

    1. Connect to the server via SSH

    2. Open the crontab editor by executing the following command:

      # crontab -e
    3. Add the following line to create a task which removes files like magick-* from the directory /tmp every minute:

      * * * * * find /tmp -maxdepth 1 -type f -name "magick-*" -delete

Additional information

Scheduling Tasks | Plesk Obsidian documentation

How to set up a task to be executed every X minutes on a Plesk server?

How to Create and Manage Cron Jobs on Linux

Exit mobile version