On 19Nov2016 17:16, bruce <badouglas@xxxxxxxxx> wrote:
After wayyyyyyy too long my ssh screen process to run a remote app via
screen works.. [...]
//--this crafts the initial named screen session.. no app detached..
ssh crawl_user@67.205.145.36 "screen -dmS 'crawlSession '
//--this then attaches to the named/detached session, and the window '-p 0'
//-- and runs the app, with a "cr"
ssh crawl_user@192.241.144.139 "screen -r -p 0 -S 'crawlSession'
-X stuff '/crawl_tmp/screen_test.php'$(echo -ne '\015') "
I'm glad you have your process sorted. Now to refine things a little!
You're passing (apparently) arbitrary strings to your remote ssh command, and
slapping single quotes around these strings to keep them correct for the shell
at the far end. If you know your strings will not themselves _ever_ have single
quotes in them this will work, but why impose this (dangerously unwritten)
requirement on your setup?
When I run an arbitrary remote command via ssh I invoke it via this wrapper:
https://bitbucket.org/cameron_simpson/css/src/tip/bin/sshx
which uses shqstr to quote the command line correctly. So your above commands,
run this way, would look like:
session=crawlSession # or whatever
cr=$(echo -ne '\015')
sshx crawl_user@67.205.145.36 screen -dmS "$session"
sshx crawl_user@192.241.144.139 screen -r -p 0 -S "$session" -X stuff "/crawl_tmp/screen_test.php$cr"
so that you only need to get the local quoting correct. sshx needs shqstr,
which is a python programme. There's a pure-shell version here:
https://bitbucket.org/cameron_simpson/css/src/tip/bin/shqstr-sh
Cheers,
Cameron Simpson <cs@xxxxxxxxxx>
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx