这里以hadoop的进程为例,大家看做是普通java进程即可
1.tmpwatchman tmpwatch可以看到tmpwatch是用来删除一些上时间未使用的临时文件NAME
tmpwatch – removes files which haven’t been accessed for a period of
time
OPTIONS
-u, –atime
Make the decision about deleting a file based on the file’s
atime (access time). This is the default.
Note that the periodic updatedb file system scans keep the atime
of directories recent.
-m, –mtime
Make the decision about deleting a file based on the file’s
mtime (modification time) instead of the atime.
-c, –ctime
Make the decision about deleting a file based on the file’s
ctime (inode change time) instead of the atime; for directories,
make the decision based on the mtime.
-d, –nodirs
Do not attempt to remove directories, even if they are empty.
-d, –nosymlinks
Do not attempt to remove symbolic links.
这里重点看-umc和-d 参数 -umc很清楚 访问,修改,创建时间-d参数 不会删除子目录,即使是空的,也不会删除符号连接
2./etc/cron.daily/tmpwatchcat /etc/cron.daily/tmpwatch可以看到定时执行的tmpwatch任务flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix /
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 240 /tmp
/usr/sbin/tmpwatch "$flags" 720 /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch "$flags" -f 720 "$d"
fi
done
该任务每天执行一次这里看到-umc同时被设置,如果同时被设置,那么取的是最大时间,时间以小时为单位-x表示需要跳过的路径,这些路径不会被删除想必大家看明白这段脚本了
3.jinfo使用jinfo命令查看一个进程jinfo 30352结果如下Attaching to process ID 30352, please wait…
Debugger attached successfully.
Server compiler detected.
jvm version is 20.4-b02
Java System Properties:
java.runtime.name = Java(TM) SE Runtime Environment
sun.boot.library.path = /usr/java/jdk1.6.0_29/jre/lib/amd64
java.vm.version = 20.4-b02
。。。。。。。。。。。。。。。。
file.encoding.pkg = sun.io
sun.java.launcher = SUN_STANDARD
user.country = US
sun.os.patch.level = unknown
java.vm.specification.name = Java Virtual Machine Specification
user.dir = /home/hadoop/hadoop
java.runtime.version = 1.6.0_29-b11
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.endorsed.dirs = /usr/java/jdk1.6.0_29/jre/lib/endorsed
os.arch = amd64
java.io.tmpdir = /tmp
line.separator =
。。。。。。。。。。。。。。。。。。。。。表示省略,其中注意红字部分java.io.tmpdir = /tmp这里表示java进程的临时输出目录且会在/tmp/生成进程的pid文件,并且会生产/tmp/hsperfdata_用户名 目录我这里是hadoop-hadoop-jobtracker.pid hsperfdata_root 本文链接http://www.cxybl.com/html/wyzz/JavaScript_Ajax/20130711/39048.html
欢迎大家阅读《jstat 命令: jps jstat 命令失效的问题…_js》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码