【发布时间】:2015-02-12 20:43:21
【问题描述】:
我有一个用 ruby 编写的重启脚本
#!/usr/bin/env ruby
require "#{DIR}/etc/control_helper"
###### MAIN program ################
case action
when 'start'
.....
when 'stop'
.....
when 'restart'
kill_the_old_process_if_needed(PORT_NUM, APP_NAME, APP_FILE_NAME)
new_pid = start_a_new_process!(ENVIRONMENT, PORT_NUM, APP_FILE_NAME)
#here there is an **exit(0)**
check_for_success_in_starting_new_process!(hostname, new_pid)
end
从本地机器运行代码工作:
ruby etc/control_app.rb restart production
但从远程 ssh 运行它(詹金斯机器,代码更改后) 不退出。
gcloud compute ssh remote_server --zone us-central1-a --command "cd /path/to/app; ruby etc/control_app.rb restart production"
如果我编辑脚本并首先输入
exit(0),然后它就会退出。我知道它会到达出口 (0),因为我在它的正上方放置了一个打印件。
【问题讨论】:
标签: linux ssh google-cloud-storage gcloud