title: SSH and create a log file named as the machines name
body: <p>I run a script which ssh a host and runs a java program. I use nohup and want the output and error log file name to be as hostnameoutput.log and hostnameerror.log. I can't get to run the program. I tried to save the value in a variable and append it to the log file name and tried the direct approach also.</p>
  
  <p>The one below is the direct approach to create a log file which appends the machine name. What is the error here?</p>
  
  <pre><code>ssh $host "hostname; nohup java -cp program.jar &gt;hostnameoutput.log 2&gt;hostnameerror.log &amp; "
  </code></pre>