独角兽企业重金招聘Python工程师标准>>>
第二部分: 手动测试服务,以命令的方式快速启动服务,主要是写plist前的验证.
launchctl:
1. 快速验证启动服务程序是否能成功运行,不需要复制org.apache.tomcat.plist到
~/Library/LaunchAgents
/Library/LaunchAgents
/Library/LaunchDaemons
/System/Library/LaunchAgents
/System/Library/LaunchDaemons
意思是快速验证一个需要部署的程序是否能正确运行,当然配置也得和plist一样.
[plain]view plaincopy
launchctlsubmit-lorg.apache.tomcat-o`pwd`/stdout.log-e`pwd`/stderr.log-p/Users/apple/Desktop/apache-tomcat-5.5.25/bin/catalina.shrun
2. 停止服务
[plain]view plaincopy
launchctlstoporg.apache.tomcat
3. 移除当前job里的服务
[plain]view plaincopy
launchctlremoveorg.apache.tomcat
4. 提示错误 launchctl run error: File exists
表示job已经启动过,需要先停止再移除才可以重新运行.
[plain]view plaincopy
launchctlstoporg.apache.tomcatlaunchctlremoveorg.apache.tomcat
5. 配置的输出提示错误,说明没有配置 JAVA_HOME 环境变量.
[plain]view plaincopy
NeithertheJAVA_HOMEnortheJRE_HOMEenvironmentvariableisdefinedAtleastoneoftheseenvironmentvariableisneededtorunthisprogram
6. 设置环境变量
[plain]view plaincopy
launchctlsetenvJAVA_HOME`/usr/libexec/java_home`
7. 删除环境变量
[plain]view plaincopy
launchctlunsetenvJAVA_HOME
/infoworld/article/details/47419877