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腳本也啓動只有一個進程。
有人能解釋一下上面的觀察嗎?
需要做些什麼來糾正?