Keep Python Server Running even after closing the terminal

Suppose you use following command to run your python server
python runserver
But once you close the terminal, process is killed and python server is stopped automatically.
This can be a bigger problem if server is placed remotely and you want to keep it running always whether your system is turned on or turned off.

Here is a solution for you. Use nohup with your command.
nohup your-command &

In this case, Run this command
nohup python runserver &
Now if you close the terminal, server still runs.

postgres: Postgres-XC: must start as either a Coordinator (--coordinator) or Datanode (--datanode)

Postgresql Server Error in Ubuntu :
postgres: Postgres-XC: must start as either a Coordinator (--coordinator) or Datanode (--datanode)

To remove this error, remove the package
apt-get --purge remove postgres-xc
But if you are not able to remove it because of an error, Find all processes of postgres using
ps aux | grep postgres
ps aux | grep psql

and kill all one by one. Now try to remove again.

Now install these packages:
apt-get install postgresql-client-common
apt-get install postgresql-common
apt-get install postgresql-9.3
apt-get install postgresql-client-9.3
apt-get install postgresql-contrib-9.3

* No PostgreSQL clusters exist; see "man pg_createcluster"

psql error : * No PostgreSQL clusters exist; see "man pg_createcluster"

If you are trying to start postgresql server and you get this error.
Here is solution for you.

First you need to find the server version of your postgresql then you need to create cluster.

Suppose your server version is 9.3
pg_createcluster 9.3 main --start

psql: could not connect to server: No such file or directory

 psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

 If you are trying to open command prompt of postgresql using command psql and it gives above error it means your postgresql server is not started, you need to start it first.
service postgresql start
If it is giving error postgresql: unrecognized service, it means you are not starting correct service, you need to verify the correct name of the service.
Is it postgresql-9.3 or postgresql-9.4 or postgresql-8.4?

Now restart it after confirmation.
service postgresql-9.3 start
service postgresql-9.4 start
service postgresql-8.4 start

psql: FATAL: Ident authentication failed for user "root"

Postgresql error
psql: FATAL:  Ident authentication failed for user "root"

If you run command psql on terminal as root user and you get the error
psql: FATAL:  Ident authentication failed for user "root"
Here is solution for you. 

To resolve this error, Run these two commands on your terminal.
sudo -u postgres createuser root
It might give you this message
could not change directory to "/root"
Do not worry about it, when it asks
Shall the new role be a superuser? (y/n)

Enter y and press return key.

and the other command is
sudo -u postgres createdb root -O root
Now run command psql on terminal and you will log into postgresql command prompt as user root.

To check the list of postgresql databases, run command

to quit the psql command prompt, run command

Find Orientation of an image captured by a digital camera or mobile / cell phone

Download exiftool tar file from and extract it. Now run these commands.
First change directory.
cd Image-ExifTool-9.78/
Run these commands one by one.

perl Makefile.PL
make test
make install

To find the orientation of a camera image run command after installation :

exiftool Orientation -n "/path/of/camera_image.jpg"
Do not use downloaded image, make sure it is clicked by digital camera.

Note : Orientation means the correct position of the image with respect to the camera button when it was clicked.

ssh: Could not resolve hostname Name or service not known

If you are trying to run git commands to pull and push and you are getting this. Here is the solution for you.

Open file /etc/resolv.conf and add following line in it

Now save the file and try to pull/push again.

Warning: No xauth data; using fake authentication data for X11 forwarding

Either you have changed your hostname or any similar activity on your system that's why other system is not identifying you.

Solution :
Run this command on terminal
xauth add :0 . `mcookie`
To check whether your hostname is added in the list or not, run
xauth list
Now ssh into other system, you will not get this error.

Received disconnect from IP: 2: Too many authentication failures for root

Received disconnect from : 2: Too many authentication failures for root

You are getting this error because your public keys are not saved on the server and it is not prompting for password so the public key authentication is failed, it throws you back on the command prompt with error.

The solution is simple. Either you need to save your public keys on server in authorized_keys file or set PubkeyAuthentication=no in your command. Now it will ask for password.

ssh -o PubkeyAuthentication=no server-IP
Example :
If you want to loginto server whose IP is, Run

ssh -o PubkeyAuthentication=no

Related Posts Plugin for WordPress, Blogger...