2013-08-24 17:34 阅读 50


i am trying to sun a bash script when i update something:

public function reloadServer()
    exec ('/var/www/html/script', $y);

this is the script file

# test
ssh root@192.168.526.33 "server -rx reload"
echo "success"

what happens is that get the success message, but the command doesn't get run. if i run the command manually it works just fine

note: i can't use ssh2_exec because of some problems on my server

any ideas on what is happening or how can i debug that bash script ?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dongshi2141 dongshi2141 2013-08-24 17:43

    Place your command inside a subshell and tee its output:

    # test
    ( ssh root@192.168.526.33 "server -rx reload" ) 2>&1 | tee -a /some/where.log
    echo "success"

    Through that you'll see all the messages including possible messages from bash.

    点赞 评论 复制链接分享