2

I'm having troubles to run a python script in DigitalOcean.

I have two doubts.

  1. How to upload the scripy.py to DigitalOcean droplet.
  2. How to run the script.

I'm able to access to the console, but further that I don't know what to do and i can't find any specific information on internet.

I'm running a Ubuntu 14.4 Droplet through web.

exsnake
  • 1,767
  • 2
  • 23
  • 44
  • 1
    Is this a linux droplet? Are you accessing the console over SSH or through the digitalOcean website? What have you tried so far? – nathan.medz Feb 14 '18 at 19:44
  • @nathan.meadows I updated the question. I haven't tried anything to be honest, don't know where to start. – exsnake Feb 14 '18 at 19:47
  • 1
    "I haven't tried anything to be honest," At least you're honest. Easiest way is to send files via FTP, the SSH into the droplet to use python and run it – SuperStew Feb 14 '18 at 19:49
  • Theres a lot of ways to transfer files between computers/ servers, take a look at https://en.wikipedia.org/wiki/Secure_copy – nathan.medz Feb 14 '18 at 19:50

1 Answers1

1

Ok first, in order to upload any file to your droplet you can user the command scp

scp foobar.txt your_username@remotehost.edu:/some/remote/directory

Here is a related question that shows you how to use scp from Windows.

Then in the console setup in the remote host check if you can run the command python. If you do not have it, just follow the steps in the documentation and you will have python running inside your remote machine.

If you put a Python script on the server and ssh in, you can run it from the command line. For instance,

python yourFantasticScript.py

If you want a level of automation to triggering the script to run, you will need to learn more about automation scheduling and server technologies.

Max von Hippel
  • 2,856
  • 3
  • 29
  • 46
Sebas
  • 324
  • 2
  • 10