Re: ssh/screen -- cmdline vs php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]
  Powered by Linux