Greetings, i've been working with a user-friendly menu on ksh to allow users execute scripts located on a remote server, so they wont have to login and manually launch those scripts every single time.
This is a HP-UX box and currently on a /usr/bin/ksh shell.
I've setup ssh keys on both servers, so i'm able to execute commands remotely using ssh (ej, ssh vic@targetserver ls -l). My script basically gathers several variables from user input, then assambles the whole command and tries to execute it with ssh to the other server.
What i'm currently unable to do, is to finally get that command executed AND give the prompt back to the user so he can continue using the menu (even when using & and nohup).
scriptname="/home/myuser/script" -> After user input, this variable is set with the remote script name.
finalcommand="ssh user@server nohup $scriptname >/dev/null 2>&1 &"
$finalcommand
OR
finalcommand="ssh user@server nohup $scriptname >/dev/null 2>&1 &"
$finalcommand $
I've managed to get two results: Either the command does not gets executed, or it does but will not give prompt back.
If i try to manually run the full command, it will work nicelly:
ssh user@server nohup /home/myuser/script >/dev/null 2>&1 &
I'm quite sure this is a syntax/variable issue, but i've been breaking my head for two days and i'm out of ideas. My apologies in advance if more information is needed to understand the issue, i'm not used to post messages here.
Regards