CPanel Help and Knowledgebase
Search:     Advanced search
Browse by category:
Contact Us


We are moving to new location!!!

seat-timetable

Clean /tmp from old session files

Add comment
Views: 868
Votes: 2
Comments: 0
Posted: 07 Mar, 2008
by: Soumplis A.
Updated: 07 Mar, 2008
by: Soumplis A.
You may have noticed that you /tmp directory fills up with obsolete old session file from the web server. These files fill up your /tmp and besides the fact that most of the times there is not any disk space issues, a large number of files makes it almost impossible to notice strange files lying in your tmp directory. In order to clean this sessions files that are older than "Today" you can execute the following script (copy and paste it to a file on your server).


#!/bin/sh
#
# Clean session files from /tmp older than "Today"
#

echo "Clean /tmp from junk files"
TODAY=`date | awk '{print $2, $3}'`
cd /tmp

echo "-> Clear old Apache session files from /tmp"
for file in `ls -l sess_* | grep -v "$TODAY" | awk '{print $9}'`
do
     rm -f $file
done

echo "All done :-)"
Also read
document Mail Mass Delete

Others in this Category
document Roundcube on CPanel 11 (x3 theme)
document Proxy RoundCube Webmail on HTTP Port 80
document MySQL Usage Limit
document Exim Ignore MX Record
document Upgrade ClamAV to latest version



RSS