I searched for quite a while until I found the config setting to clear /tmp. But, it clears on boot, not on shutdown. At least it clears.
As far as browser caches and /var/log files are concerned, I had to write a simple bash script to do the job of clearing caches, message files, etc.
It basically consists of:
cd <some path to subdirectory>
rm * (remove all files)
cd <some other directory)
rm *
cd <somewhere else)
/dev/null > <filename> (where /dev/null overwrites the file, usually some log file, and leaves an empty file, without deleting the file name, which might break the system if the file no longer exists).
Since some of the files require root permission to clear their contents via /dev/null, or delete some files, so I placed the script in /root, and su to root to run the script.
It's possible to call the script during boot and clear those files, but that will make the boot process take a while longer.
This is a good time to try your hand at writing a bash script to do housekeeping chores.
|