I need to do remote login to a server and run a shell script with arguments in the background using nohup
. But I am getting an error. Am I missing anything in syntax?
Mycode:
ssh -t -t user@servername nohup /path/myscript.sh argument1 argument2 & > /path/myscrip_logfile.log
Output:
Invalid null command.
nohup accepts arguments like you have supplied, the "& >" should be "&>" and the whole command should be put in quotes as otherwise i think you are redirecting the stdout of the ssh command so try this:
ssh -t -t user@servername "nohup /path/myscript.sh argument1 argument2 &> /path/myscrip_logfile.log"