When you have provisioned your server using Laravel Forge (or Ploi) and are running cronjobs on it, it could be that your /var/spool/mqueue-client folder contains a lot of files. In my case, the server had around 4GB of files in that folder.

Note: this doesn't mean it is by every server, but some had multiple cron-schedules. That's the reason why it could be that many files in the folder.

What is mqueue-client?

The /var/spool/mqueue directory contains temporary files associated with the messages in the mail queue and may contain the log file.


How big is your folder?

To see how big your folder is, you can run the following command:

du -sh /var/spool/mqueue-client

In my case, the folder was around 4GB:

forge@my-server:/var/spool/mqueue-client# du -sh /var/spool/mqueue-client/
4.3G	/var/spool/mqueue-client/

How to clear it?

You can use a command, like rm, to remove the files:

rm /var/spool/mqueue-client/*

But when there are too many files in it, you could get an error like:

-bash: /bin/rm: Argument list too long

This folder can be huge. To clear it, you could use a script like:

#!/usr/bin/env bash

cd /var/spool/mqueue-client

echo "Starting..."
echo "Checking the amount of files in the folder..."

totalFiles=$(ls | wc -l)

echo "Found $totalFiles, time to delete..."

for i in `ls`
        rm -f $i
        percentage=$(bc <<< "scale=2; ($deleted / $totalFiles) * 100")

        echo "Deleted $i. Files deleted $deleted / $totalFiles. $percentage% complete."

It will log all deleted files; this could take a while:

Deleted df12A8K182014661. Files deleted 491. 0% complete.
Deleted df12A8K183014661. Files deleted 492. 0% complete.
Deleted df12A8K184014661. Files deleted 493. 0% complete.
Deleted df12A8K185014661. Files deleted 494. 0% complete.
Deleted df12A8K186014661. Files deleted 495. 0% complete.
Deleted df12A8K187014661. Files deleted 496. 0% complete.
Deleted df12A8K188014661. Files deleted 497. 0% complete.
Deleted df12A8K189014661. Files deleted 498. 0% complete.

Source: https://serverfault.com/a/593953

How to prevent it?

You can disable the emails by setting the output of a cronjob to "/dev/null".

For example:

0 1 5 10 * /path/to/script.sh > /dev/null

It's also possible to add an extra variable to your crontab configuration:


Robin Dirksen
Robin Dirksen

Follow me on Twitter, there I post web-related content, tips/tricks, and other interesting things.

On my blog, you can find articles that I've found useful or wanted to share with anyone else.

If you want to know more about this article or just want to talk to me, don't hesitate to reach out.