Mac修改開機啓動項

第二部分: 手動測試服務,以命令的方式快速啓動服務,主要是寫plist前的驗證.
launchctl:


1. 快速驗證啓動服務程序是否能成功運行,不須要複製org.apache.tomcat.plist到 java

~/Library/LaunchAgentsapache

/Library/LaunchAgentstomcat

/Library/LaunchDaemonsapp

/System/Library/LaunchAgents測試

/System/Library/LaunchDaemonsthis

 

意思是快速驗證一個須要部署的程序是否能正確運行,固然配置也得和plist同樣.spa

 

[plain] view plain copy.net

  1. launchctl submit -l org.apache.tomcat -o `pwd`/stdout.log -e `pwd`/stderr.log -p /Users/apple/Desktop/apache-tomcat-5.5.25/bin/catalina.sh run  


2. 中止服務blog

 

 

[plain] view plain copyip

  1. launchctl stop org.apache.tomcat  


3. 移除當前job裏的服務

 

 

[plain] view plain copy

  1. launchctl remove org.apache.tomcat  


4. 提示錯誤 launchctl run error: File exists

 

表示job已經啓動過,須要先中止再移除才能夠從新運行.

 

[plain] view plain copy

  1. launchctl stop org.apache.tomcat  
  2. launchctl remove org.apache.tomcat  


5. 配置的輸出提示錯誤,說明沒有配置 JAVA_HOME 環境變量.

 

 

[plain] view plain copy

  1. Neither the JAVA_HOME nor the JRE_HOME environment variable is defined  
  2. At least one of these environment variable is needed to run this program  


6. 設置環境變量

 

 

[plain] view plain copy

  1. launchctl setenv JAVA_HOME `/usr/libexec/java_home`  


7. 刪除環境變量

 

 

[plain] view plain copy

  1. launchctl unsetenv JAVA_HOME  

 

 

http://blog.csdn.net/infoworld/article/details/47419877

相關文章
相關標籤/搜索