2016-10-03 57 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" 

別名運行良好,現在