When the TMP directory is full, many sites, especially the MySQL service, experience problems and access problems. We will create cron to solve this problem.
First, we create the file that we will run in cron.
nano /usr/bin/tmpsil
The file content will appear blank. Into the file:
#/usr/bin/!
cd /tmp
find . -type f -print -exec rm {} \;
service mysql reload
After pasting the lines, we exit the file and save it with the ctrl + x command.
Then, we provide permissions to our file on the shell command client.
chmod +x /usr/bin/tmpsil
Now you can make the necessary settings to delete tmp whenever you want. Additionally, when we want to delete it manually, you can delete it by using the tmpsil command on the shell command client.
After entering the crontab adding page using the crontab -e command, you can edit and add the crontab below as you wish.
0 2 * * * /usr/bin/tmpsil > /dev/null 2>&1
Thanks to this crontab, the tmp area of the server will be cleaned every day at 2 am.
You can click for our Türkiye location physical servers.
You have examined the knowledge base in detail, but if you cannot find the information you need,
Create a Support Ticket