Python script gets killed

I am a newbie to digitalocean.

I have just created the smallest VPS and then install python, pip and all required python modules in order to move my scripts which work fine on local server.

Right now, my script starts without any problem but suddenly gets killed. How can I understand the reason and solve this problem?

Do you have any idea under which circumstances digitalocean VPS kills any running script?

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

If this is smallest Droplet it could that script run out of memory. You should check syslog for Out Of Memory killer. syslog is located at /var/log/syslog and you can opet it with your favourite text editor:

  1. nano /var/log/syslog

Here you can try to find Out of Memory (OOM) killer signal. If there are for your script, it means you ran out of memory. If you need help with logs, post part of it here, but make sure you redact sensitive informations if they are any.

Site Moderator
Site Moderator badge
June 7, 2023


In such cases where you have the smallest Droplets, it’s possible the issue is happening because you don’t have enough memory. That could be checked in the /var/log/syslog log. If that is the case, you’ll OOM signals which are Out of Memory messages.

In such cashes people would go for the upgrade right away, having said that, before that you can try using SWAP. Swap is a portion of hard drive storage that has been set aside for the operating system to temporarily store data that it can no longer hold in RAM. This lets you increase the amount of information that your server can keep in its working memory, with some caveats. The swap space on the hard drive will be used mainly when there is no longer sufficient space in RAM to hold in-use application data.

The information written to disk will be significantly slower than information kept in RAM, but the operating system will prefer to keep running application data in memory and use swap for the older data. Overall, having swap space as a fallback for when your system’s RAM is depleted can be a good safety net against out-of-memory exceptions on systems with non-SSD storage available

More about that here:

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel