nohup create new files nohup.out by day

妖精的绣舞 提交于 2019-12-10 11:55:59

问题


I don't know if I can do it with nohup, but this is the question.... I have this command:

nohup java -XX:MaxHeapFreeRatio=70 -Xmx2048M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof -jar $iscsiJar &

and I want that when the day change I save the before day nohupYYYYMM01.out and create another file nohupYYYYMM02.out , of course, with out kill my process. =)

Is it possible, how do I program it in shell script?

thanks a lot!


回答1:


I think one solution for this is using Supervisord.

Below a example of /etc/supervisord.conf

...
[program:coherence]
command=java -XX:MaxHeapFreeRatio=70 -Xmx2048M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof -jar $iscsiJar &
directory=/u01/jdk
autostart=true
autorestart=true
startretries=3
stderr_logfile=/var/log/java.err.log
stdout_logfile=/var/log/java.out.log
user=oracle
stopsignal=KILL
killasgroup=true
stopasgroup=true

Using supervisord you can stop/start this process like was a service.



来源:https://stackoverflow.com/questions/27449372/nohup-create-new-files-nohup-out-by-day

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!