Friday, January 2, 2015

Keep Python Server Running even after closing the terminal



Suppose you use following command to run your python server
python manage.py 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 manage.py 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
or
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