nohup按天创建新文件nohup.out [英] nohup create new files nohup.out by day

查看:156
本文介绍了nohup按天创建新文件nohup.out的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我是否可以用nohup做到这一点,但这是问题....我有以下命令:

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 &

,我希望当日期更改时,我保存前一天的nohupYYYYMM01.out并创建另一个文件nohupYYYYMM02.out,当然,要杀死我的进程.=)

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. =)

有可能,如何在shell脚本中对其编程?

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

非常感谢!

推荐答案

我认为对此的一种解决方案是使用 Supervisord

I think one solution for this is using Supervisord.

在/etc/supervisord.conf示例中

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.

这篇关于nohup按天创建新文件nohup.out的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆