Report this

What is the reason for this report?

Local Device Terminal Script launch but Digital Ocean Script does not launch, viceversa.

Posted on April 10, 2019

Basically , i ran a script on my droplet / virtual server. It ran well , i use digital ocean console. The next day i connected using the mac terminal, added SSH key, and bash ./thescript from the terminal, the script runs well, without stopping i went to digital ocean console terminal and open it up the script is not running.

I thought to myself maybe when i close the terminal on my mac it wont ran.

So i ran the script FIRST on DIGITAL OCEAN console.

Then connect to the droplet on my TERMINAL MAC local device. Script does not have the output.

Thank you for your time.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

If you need the script to run constantly even if you close your SSH session, I would recommend using screen.

To start a new screen session run:

screen -S SOME_NAME_HERE

Then inside the screen session run your script. After that to detach from the screen session press CTRL+A+D.

Then even if you close your terminal the script would remain running in the screen session.

If you need to attach back to the screen session run:

screen -R SOME_NAME_HERE

To list the available screen sessions run:

screen -ls

Hope that this helps! Regards, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.