1
我使用下面的脚本来启动一个Java守护进程(命令经由根用户启动):重复过程经由外壳脚本推出
#!/bin/sh
sudo -u postfix CONFIG_LOCATION=/mnt/custom java -Dcom.sun.management.jmxremote.port=10020 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.util.logging.config.file=${PresentWorkingDirectory}/logging.properties -cp "${ExecutableJar}:${PresentWorkingDirectory}${ClassPath}" com.x.y.filter <&- 1>/dev/null 2>&1 &
这导致两个运行的进程和我的发射在'ps -f -All'输出中看到以下记录:
4 S root 24250 1 0 82 0 - 26247 - 20:33 pts/1 00:00:00 sudo -u postfix CONFIG_LOCATION=/mnt/custom java -Dcom.sun.management.jmxremote.port=10020 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.util.logging.config.file=${PresentWorkingDirectory}/logging.properties -cp "${ExecutableJar}:${PresentWorkingDirectory}${ClassPath}" com.x.y.filter <&- 1>/dev/null 2>&1 &
4 S postfix 24252 24250 47 82 0 - 364460 184466 20:33 pts/1 00:00:31 java -Dcom.sun.management.jmxremote.port=10020 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.util.logging.config.file=${PresentWorkingDirectory}/logging.properties -cp "${ExecutableJar}:${PresentWorkingDirectory}${ClassPath}" com.x.y.filter <&- 1>/dev/null 2>&1 &
我无法理解为什么启动两个进程?
虽然我打算只运行一个进程,我的shell脚本也启动只有一个进程。
有人能解释一下上面的观察吗?
需要做些什么来纠正?