1

I am new to code and have hosted my website on a dedicated server using Ubuntu 20.04. I have installed Cyber Panel to manage my website. But after 2~3 days my website stopped working and when I check df -h it shows /tmp is 100% occupied.

Is there a way, I can get rid of this data and can set auto clean using ssh or Cyber Panel Cron job?

Here is df -h output:

df -h

'free -m' enter image description here

  • `dh`? Do you mean `du`, or `df`? `/tmp/` usually is [just a folder](https://superuser.com/a/332616/500826) under the root partition. Ubuntu server with just that software? Add the output of `df -h`. – Pablo Bianchi Mar 10 '22 at 05:14
  • https://i.stack.imgur.com/dPbAk.png Here is the output – zeeshan akram Mar 10 '22 at 05:20
  • 1
    Are you sure the website stops working because `/tmp` is full? What sort of software is being used for the site? Is it a Node or WordPress package? Can you [edit] the question to include the terminal output of `free -m`? This will show memory information – matigo Mar 10 '22 at 06:06
  • @matigo This means, when I want to login into the dashboard, it redirects me to the website homepage. when I check the log, there it shows database storage full error. it is WordPress, When I clear /tmp using 'sudo find /tmp -type f -atime +1 -delete' website start working again – zeeshan akram Mar 10 '22 at 06:10
  • Always make sure have /tmp in a separate partition and increase the size accordingly, second make a script if it gets higher then 90% it will delete its contents. – zabiullah Mar 10 '22 at 06:15
  • @zabiullah Yes, actually this is what I want. Can you guide me on how to write and add that script? Thanks for your response – zeeshan akram Mar 10 '22 at 06:17
  • Something is not adding up. Your database is not stored in `/tmp`, but `/var/lib/mysql` (if you're using MySQL), and your `/` device shows as having 40GB of space available. How is WordPress installed? Is it a snap? Is `/tmp` something that you created during the system setup? If so, [this answer from a few years ago](https://askubuntu.com/a/199708/1222991) might offer a solution, but only if your WordPress installation is using a traditional LAMP stack rather than a packaged offering – matigo Mar 10 '22 at 06:48
  • #!/bin/bash tmp_usage=$(df -hP /tmp | tail -1 | awk '{ print 0+$5 }') if [ $tmp_usage -gt 90 ] then rm -rf /tmp/* fi – zabiullah Mar 10 '22 at 08:12
  • Thank you for helping out. – zeeshan akram Mar 10 '22 at 09:34

0 Answers0