In a Linux System, services like Apache, mysql write temporary files to /tmp partition. If /tmp partition is full then there is a high chance of service could crash.

To overcome this situation, we are going to use tmpwatch utility to clear the /tmp partition.

Let’s install tmpwatch utility. If its centos, we can install tmpwatch using yum utility.

yum -y install tmpwatch

To clear the tmp partition, execute the below mentioned command.

tmpwatch –all -mtime 24 /tmp

The above command will delete the files which are older than 24 hours.

To perform this task periodically,  let’s add it in crontab

@daily * * * *  /usr/sbin/tmpwatch –all –mtime 24 /tmp

 

 

Leave a Reply

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny