简体   繁体   English

将HeapDumpOnOutOfMemoryError文件.hprof授予他人读取权限

[英]Give read permission to others for HeapDumpOnOutOfMemoryError file .hprof on generated

I start my java with these arguments 我从这些参数开始我的Java

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/log/${SERVICE}_`date +%Y-%m-%d:%H:%M:%S`.hprof"

When heap dump occurs, the .hprof file has -rw------- (600) permission, which can't be read by other users. 发生堆转储时, .hprof文件具有-rw------- (600)权限,其他用户无法读取。

How do I make these files generated with 644 permission? 如何使这些文件获得644权限生成?

Attempt : I tried passing this -XX:+HeapDumpOnOutOfMemoryError="chmod 644 *.hprof" but got the error: 尝试 :我尝试传递此-XX:+HeapDumpOnOutOfMemoryError="chmod 644 *.hprof"但收到错误:

Improperly specified VM option 'HeapDumpOnOutOfMemoryError=chmod'

What should be the correct syntax? 正确的语法应该是什么? Thank you 谢谢

Found the issue, the correct args list should be 发现问题后,正确的args列表应为

-XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError='chmod 644 *.hprof' -XX:HeapDumpPath=/log/${SERVICE}_`date +%Y-%m-%d:%H:%M:%S`.hprof"

Since I put everything inside double quote and then put in JAVA_OPTIONS , the inner quotes should be single 由于我将所有内容放在双引号中,然后放入JAVA_OPTIONS ,因此内部引号应为单引号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM