0

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

public function reloadServer()
{
    exec ('/var/www/html/script', $y);
    Zend_Debug::dump($y);
}

this is the script file

#!/bin/bash
# test
ssh [email protected] "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
  • 1
    Try to increase the verbosity of the ssh to maximum and show us what you get in $y. Optionally check if the return_var of the exec() is indeed 0. You can force ssh to go verbose by adding -vvv as its argument. Commented Aug 24, 2013 at 17:40

1 Answer 1

1

Place your command inside a subshell and tee its output:

#!/bin/bash
# test
( ssh [email protected] "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.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks, now i see a lot more info. I added -vvv as @Shadow Walker suggested and that showed me a lot more info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.