Mac修改开机启动项

第二部分: 手动测试服务,以命令的方式快速启动服务,主要是写plist前的验证.
launchctl:


1. 快速验证启动服务程序是否能成功运行,不需要复制org.apache.tomcat.plist到 

~/Library/LaunchAgents

/Library/LaunchAgents

/Library/LaunchDaemons

/System/Library/LaunchAgents

/System/Library/LaunchDaemons

 

意思是快速验证一个需要部署的程序是否能正确运行,当然配置也得和plist一样.

 

[plain] view plain copy

  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. 停止服务

 

 

[plain] view plain copy

  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

 

 

转载于:https://my.oschina.net/u/261246/blog/909016

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值