Monday, 15 April 2013

bash script not capturing stdout, just stderr -



bash script not capturing stdout, just stderr -

i have next script (let's phone call move_site.sh) copies website directory construction server

#!/bin/bash scp -r /usr/local/apache2/htdocs/$1 http@$2:/local/htdocs 1>$1$2.out 2>&1

so calling command line, pass webiste site directory name, , destination server such:

nohup ./move_site.sh site1 server1 &

however, in resulting named site1server1.out, there stderr messages, if any.

can tell me how can file , directory names copied, included in output file, have kind of record?

thanks.

a quick seek : maybe because when went fine, scp doesn't print stdout (?).

have seek : run scp command outside script, don't have on std out. (redirect nil $1$2.out, it's still nil :))

i don't think possible scp rsync can track has been transferred stdout. changing scp -r rsync -r -v -e should trick. (at to the lowest degree if can go rsync unstead of scp).

bash

No comments:

Post a Comment