Remote Compilation Using ssh and make

Here's a quick lesson in setting up scripts to use the ssh and make commands for compiling on a remote machine.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Immediate help in automating a small shell script

Vamsi Krishna.Kunasani's picture

Q) I had done the ssh public/private key generation process and my system get connected to remote system automatically with out password. But I want to get this executed through script and when doing this after getting connected to the remote system,the script is being not working.

for example:
ssh {sample ip}
echo "hai vamsi"

just connecting to remote system and stopping over there.

I need your help in this regards to proceed further ,where I get connect to the remote system and then display the echo string.

Thanks in advance

SSH in script

Mitch Frazier's picture

Once the ssh command connects to the remote system the script is going to "pause" execution until the ssh command exits. This is normal behavior: the shell waits for each command to complete execution before it moves on to the next command.

If you were thinking that the echo command was going to execute on the remote system... it doesn't work that way. If you want to execute the echo remotely then your script needs to be:

ssh echo "hai vamsi"

If you want to execute more than one command remotely then you should place them in a script on the remote system and execute the script with the ssh command.

Mitch Frazier is an Associate Editor for Linux Journal.

One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix