2016-10-03 78 views
0

目前我使用永远我开始aGhost NPM服务器和LaunchAgentOSX launchctl,如何在卸载停止作业

<?xml version="1.0" encoding="UTF-8"?> 
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
    <plist version="1.0"> 
    <dict> 
     <key>KeepAlive</key> 
     <dict> 
      <key>SuccessfulExit</key> 
      <false/> 
     </dict> 
     <key>Label</key> 
     <string>rhino.forever.ghost</string> 
     <key>ProgramArguments</key> 
     <array>        
      <string>..../bin/node</string> 
      <string>..../bin/forever</string> 
      <string>start</string 
      <string>-w</string> 
      <string>..../index.js</string> 
     </array> 
     <key>RunAtLoad</key> 
     <true/> 
    </dict> 
    </plist> 

与启动它:

launchctl load -w ~/Library/LaunchAgents/rhino.forever.ghost.plist 

但它不会在卸载时停止它:

launchctl unload ~/Library/LaunchAgents/rhino.forever.ghost.plist 

是否有任何阻止它卸载时?

感谢您的意见

+0

您是否收到任何错误? –

+0

不,但我解决了使用bash别名启动/重新启动/停止它,请参阅我的答案 – erwin

回答

0

我决定开始|停止|重新启动我的鬼应用“犀牛”与.bash_aliases

alias rhino.dev.start="nginx.start; 
    cd /Users/..../myghostapp; 
    ~/.../bin/forever start -aw --uid 'rhino' index.js; 
    forever list" 

alias rhino.dev.stop="forever stop 'rhino' ; nginx.stop" 

alias rhino.dev.restart="forever restart 'rhino' ; nginx.restart" 

别名运行良好,现在