Friday, May 17, 2013

Supervisord Common Commands


Invoke the supervisor shell:
sudo supervisorctl

# all of the following commands can be run within the supervisor shell or from the UNIX CLI

View processes managed by supervisord:
sudo supervisorctl status

Start/Stop/Restart processes from the UNIX command line:
sudo supervisorctl start processname
sudo supervisorctl stop processname
sudo supervisorctl restart processname

View standard error:
supervisorctl tail -f  processname stderr

Load changes to configuration without restarting unaffected processes:
supervisorctl reread  # reads the configuration changes
supervisorctl update  # restarts changed process groups

Reload supervisor processes and configurations, but doesn't restart supervisor itself:
supervisorctl reload

Sources:
http://stackoverflow.com/questions/3792081/will-reloading-supervisord-cause-the-process-under-its-to-stop

Wednesday, May 15, 2013

Postgres Configuration on RedHat

This will install Postgresql on a RedHat 6.4 or CentOS 6.4 system and will allow password-protected remote login access. 

# Open the firewall to allow remote postgres connections
sudo /sbin/iptables -A INPUT -p tcp --dport 5432 -j ACCEPT

sudo /sbin/service iptables save
sudo /sbin/service iptables restart

# Install packages through yum
sudo yum install vim-enhanced
sudo yum install postgresql-server

# Initialize a new database directory
sudo service postgresql initdb 

# Start the database server
sudo service postgresql start 

# Add postgres to the default runlevel 
sudo chkconfig postgresql on
sudo chkconfig postgresql --list
sudo chmod 755 /home/idcuser/

# Edit the postgres.conf to allow connections from all ips
sudo vim /var/lib/pgsql/data/postgres.conf
listen_addresses="*"

# Edit the pg_hba.conf file to allow password auth for any ip
sudo vim /var/lib/pgsql/data/pg_hba.conf
host all all 0.0.0.0/0 md5

# Restart postgres
sudo /etc/init.d/postgres restart

# Configure a postgresql superuser and new schema. 
sudo -u postgres psql
psql> create role idcuser superuser createdb createrole inherit login;
psql> alter user idcuser with password 'password';
psql> create database sample;
psql> \c sample
psql> create schema sample;
psql> alter user idcuser set search_path to sample,public;

Change Keybindings for Emacs-like Editing

Move left-ctrl to left-alt

Contents of .Xmodmap

clear Mod1
clear Control 
clear Mod2 

keycode 64 = Control_L Control_L Control_L Control_L 
keycode 37 = Alt_L Alt_L Alt_L Alt_L 
keycode 108 = Alt_R Alt_R Alt_R Alt_R 
keycode 127 = Num_Lock 

add Mod1 = Alt_L Alt_R 
add Control = Control_L Control_R 
add Mod2 = Num_Lock

Make effective without loging in
xmodmap ~/.Xmodmap

Save current keybindings
xmodmap -pke > ~/.Xmodmap-original

Source:
Dustin Lacewell http://ldlework.com/