ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i have a bash script that runs on my local computer
and moves files from one remote computer to another
for processing. the processing computer executes its
processing via its own bash script.
is there a way i can have my local computer's script
tell the processing computer to run its own processing
script? currently, i'm waiting for the local script to
complete and then going over to the processing computer
to start its script. would be a lot easier if i could
put it all into the local script. just have no idea
how.
great suggestion neuzen. one question: if, as you suggest,
i issue a command via ssh, and that command is to run a
script on the remote computer, when does my local script
continue? after the ssh command is issued? after the remote
script starts? after the remote script ends? if it's the
last of these possibilities i'd have a problem since the
remote script will take hours to run and i'm ready to move
on as soon as it's been told to start running.
oops. just hit a snag. got ssh working and can start a remote
script from my local script (yay!). problem is, remote script
has to be in remote's home directory, not subdirectory. i
need to send both a cd command, as well as the command to
start the script. so far, all i know how to do is the login
and send one command. i have this to run the script if it's
in the home directory:
ssh useracct@remotecomputer ./script_to_run.sh
what i need to be able to do is something like:
ssh useracct@remotecomputer cd Documents/Scripts ./script_to_run.sh
Including the full path to a command (or fully defining the environment) is best practice for scripts anyway. A change in the environment won't run the wrong command.
thanks neuzen and jschiwal. i had one of those 'DOH!' moments
driving home after posting the question when i realized just
what you're saying. i'd still be very interested, though, to
know about issuing multiple commands through an ssh script.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.