How to kill processes by running time

htop-screenshot-8-cores

Heres a little trick to kill of unwanted processes that are running for more than X minutes on Linux.

I use this on a production server, where imagemagick and ffmpeg are executed many thousands of times per day and in normal conditions each process takes 0.x to 30 seconds. On rare cases they seem to run out of control and never finish execution or take longer than seems reasonable and worthwhile for the particular task. To free up resources taken by such processes, I decided it would be ok to just kill them if they are running for more than 10 minutes. It may not be a very safe and beautiful way to deal with such processes, but it’s working well for me for years now, so I’ll share… Continue reading

How to migrate WordPress site to CloudFlare SSL

In this article I’m going to show you how to enable CloudFlare Flexible SSL for your WordPress website.

Cloudflare flexible SSL is the simplest method, to get your site running under SSL (HTTPS) fast and free. Using CloudFlare, you don’t need to purchase an SSL certificate and do any complicated server configuration, pretty much any host will work.
I will try to create very detailed guide on how to do this right, with proper redirects for non-SSL content and HSTS. Don’t be afraid of it’s length, the steps are fairly simple.

What you gonna need

  • A WordPress site with admin access and ability to install plugins.
  • Access to your domains DNS records. In the example I’m going to use a domain name registered at godaddy.com, but any other registrar should work, you just have to look for an option to change name servers.
  • CloudFlare account. You can create one for free here: https://www.cloudflare.com/a/sign-up

Continue reading