django中session选择文件形式存储,貌似没有自动垃圾清理的机制,所以会造成很多的无用session文件
删除30分钟没有活动的会话,这里默认每次页面访问都会读取session。
find /tmp/ -type f -name "sessionid*" -amin +30 | sudo xargs rm -f
附: 参考这里http://www.linuxselfhelp.com/gnu/findutils/html_chapter/find_2.html
文件的三种时间标志
Each file has three time stamps, which record the last time that certain operations were performed on the file:
1. access (read the file's contents)
2. change the status (modify the file or its attributes)
3. modify (change the file's contents)
对应的,find有如下时间比较条件
These tests are mainly useful with ranges (`+n' and `-n').
-atime n
-ctime n
-mtime n
True if the file was last accessed (or its status changed, or it was modified) n*24 hours ago.
-amin n
-cmin n
-mmin n