I have an scp script that looks like this:
#!/bin/bash
scp -r /usr/local/htdocs/$1 httpd@$2:/local/htdocs
I want to call it from the command line, and pass a directory, and destination server, similar to this:
move_site.sh website servername
However, I want to capture the output in a file containing the 2 parameters.
So I tried this, but it didn't print anything when calling using nohup
#!/bin/bash
scp -r /usr/local/htdocs/$1 httpd@$2:/local/htdocs > $1$1.out
How can I structure both the script and the calling command so that it runs in the background, and captures the output based on destination and site?