Setup /tmp to auto clean using tmpwatch

Question: my /tmp is full, how do i delete the content

Answer: 

a) open SSH to your server, if SSH will not connect due to disk space full in tmp, reboot your server in cloud server manager then try again.
Once connected run the following command

yum install tmpwatch -y

once tmpwatch is installed run command

/usr/sbin/tmpwatch -am 12 /tmp

this will delete all files over 12 hours old

next, we will configure your server to do this automatically.

from SSH type:  crontab -e

go to the very bottom and paste

0 4 * * * /usr/sbin/tmpwatch -am 12 /tmp

then press Control+X (on PC) or Command+x (on Mac) you will get confirmation do you want to save. Type Y for yes, and press enter

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Adding secondary IPs to Cpanel

  To access the IP Functions Menu, click on IP Functions, on the main screen...

Suspended page / Internal Server Error

If domain is showing "Internal Server Error" except suspention page after suspending the domain...

CPanel Log file locations

CPanel stores it’s log files in the /usr/local/cpanel/logs directory. Below is a list of the...

How do convert a dedicated ip to a shared ip on cPanel/WHM

In root SSH, copy the /etc/domainips file and then remove the IP from it: Code: cp...

Install RKHunter

You can install RKHunter on Linux Server by using following steps.1 Login to your server as...