docker error in crontab: the input device is not a TTY

when you run a docker command via crontab like below

# /usr/bin/docker exec -it containername /path/to/command

you will get “the input device is not a TTY” error message. To fix it simply remote -t parameter

-t, –tty Allocate a pseudo-TTY

and use only -i

Also no need to mention! Always use full path for the commands in cron or use PATH variable.

ismail yenigul



docker error in crontab: the input device is not a TTY

AWS EC2 instance type change and network connectivity issue

We switched from a t2.xlarge  instance type to m4.2xlarge, we lost the network connectivity for our Ubuntu instance.

I change back to t2 instance type the instance become reachable again.

when I check /var/log/cloud-init.log, AWS m4 instance ethernet interface name changed to ens3.

Performing a dhcp discovery on ens3

but 50-cloud-init.cfg was not updated. It has old eth0 ethernet name

# cat /etc/network/interfaces.d/50-cloud-init.cfg
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init’s network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

to solve the issue,

I added the following lines into /etc/network/interfaces and stop the instance & change the instance type

auto ens3
iface ens3 inet dhcp


ismail yenigul

AWS Certified Solution Architect





AWS EC2 instance type change and network connectivity issue

Redirect HTTP to HTTPS on nginx/apache


install&enable mod rewrite & ssl

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

If you use Amazon linux and installed Amazon linux http package(ie httpd24-2.4.27-3.75.amzn1)

then you need to install mod24_ssl instead of mod_ssl

sudo yum install -y mod24_ssl

in server block;

if ($scheme != “https”) {
return 301 https://$server_name$request_uri;
If you want to redirect www to base domain simply replace $server_name with your base domain(



Redirect HTTP to HTTPS on nginx/apache

LetsEncrypt CAFile for pkcs12 format

you may get “Error unable to get local issuer certificate getting chain.” while creating a keystore in the pkcs12 with Letsencrypt certificate.  You need to create CAFile to fix this issue.

install openjdk-8-jre for keytool, if you do not have keytool command on Linux

# sudo apt-get install openjdk-8-jre

To create CAFile, download  and merge root and intermediate certificate of Letsencrypt at

# wget  #

# wget

# cat isrgrootx1.pem.txt letsencryptauthorityx3.pem.txt > letsencryptCA.pem

# openssl pkcs12 -export -in domain.crt -inkey domain.key -chain -CAfile letsencryptCA.pem -name “mycert” -out myapp.p12

# keytool -importkeystore -deststorepass myapppass -destkeystore myapp.keystore -srckeystore myapp.p12 -srcstoretype PKCS12

Verify the keystore;

# keytool -list -v -keystore myapp.keystore -storepass myapppass

Now you can use this keystore on Tomcat/Jboss

ismail yenigul

LetsEncrypt CAFile for pkcs12 format

pg_prewarm extention to Pre-warming the buffer cache in PostgreSQL

The pg_prewarm module provides to load relation data into either the operating system buffer cache or the PostgreSQL buffer cache.
It is available for PostgreSQL 9.4 or higher releases.

You can load the most important tables to the cache when the postgresql was restarted.

First install postgresql contrib package

yum install postgresql96-contrib
apt-get install postgresql-contrib-9.6

Login to database and create the extension.

psql -U user databasename
create extension pg_prewarm;

enable prewarn on desired tables
SELECT pg_prewarm(‘tablename’);

SELECT pg_prewarm(‘languages’);
SELECT pg_prewarm(‘messages’);


You have to run SELECT pg_prewarm(‘tablename’); whenever you restart postgresql database. You can add SELECT statements into a bash script and call it when the database become online.



ismail yenigul


pg_prewarm extention to Pre-warming the buffer cache in PostgreSQL