Libin
Libin

Reputation: 33

How do I run a Ruby script remotely on Linux machine

I am connected to a Linux server from my Windows machine using putty. I need to create a ruby file and execute the same. Should I create the Ruby file on my machine or on Linux server? Please advise.

Upvotes: 0

Views: 1084

Answers (3)

Justin L.
Justin L.

Reputation: 13600

Best workflow in this case would be to write the rb script in whatever environment you want ... many people like developing locally on their own machine (which has advantages), and many prefer developing it remotely on another machine.

Basically write it the same way as you would write any ruby file on your favorite text editor using your favorite method.

Then you upload the rile to the remote machine -- you can use software like WinSCP and then run the script using ssh:

$ ssh (server address)
$ ruby (path to wherever you put the script)

Upvotes: 1

Manuel Görlich
Manuel Görlich

Reputation: 1509

It doesn't matter where you compose the script.

You can either compose it locally or remotely

When you're composing it localy you can do it with your well known GUI-Editor Tools like Notepad or so, but you'll have to upload the file to the server to use it there.

When you're composing it remotely you'll have to use CLI-Editors like nano or ViM for it, but you're able to run it instantly without uploading it

And you can run the script on the remote machine as usual

$ ruby path/to/you/script.rb

assuming ruby is already installed

Upvotes: 1

deagh
deagh

Reputation: 2724

If you want to execute the ruby file on server you have to create it on the server.

Upvotes: 0

Related Questions