- 论坛徽章:
- 0
|
在linux系统中,想用perl监视java的daemon程序,有问题就重新启动相应的java.sh。
程序大致如下:
if (rc == -1) {
system("./java.sh" ;
}
在java.sh中:
#!/bin/bash
cd /usr/java_app/bin
nohup java ServerDaemon &
出现的问题是:
perl程序正常退出,但java.sh不能自动启动。但java.sh可以在terminal中正常启动。
我查过nohup的info:
If standard output is a terminal, it
and standard error are redirected so that they are appended to the file `nohup.out'; if that cannot be written to, they are appended to the file `$HOME/nohup.out'. If that cannot be written to, the command is not run.
用perl中的system()是不能产生nohup.out的,也没在ps中。
我用`./java.sh`也试过,不行。
请教各位大侠了。 |
|