Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run python script in DigitalOcean

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.

like image 348
exsnake Avatar asked Apr 21 '26 02:04

exsnake


1 Answers

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

scp foobar.txt [email protected]:/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.

like image 61
Sebas Avatar answered Apr 23 '26 18:04

Sebas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!