7/30/2014

Populate a whole-root directory structure

Using yum utility, we can populate a directory structure that holds bunch of software utilities. This structure could be later used as changed root environment (jail). The following command ran on Centos 6:

$ yum install --releasever=6  --installroot=/absolute/path/to/dir <package_name>

7/27/2014

Linux software RAID-1

Recover RAID-1 from the disk that survived disaster

$ mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdc 

where /dev/sdc is the surviving disk

7/21/2014

Color on bash shell prompt

vim ~/.bashrc


COLOR1='\[\033[38;5;34m\]'
COLOR2='\[\033[38;5;161m\]'
BOLD='\[\033[1m\]' # Work only if "allow bold text" setting is enabled
STOP='\[\033[0m\]'

PS1="[${BOLD}${COLOR1}\u${STOP}@${BOLD}${COLOR2}\h \W${STOP}]\$ "


For more

5/09/2014

Postgresql: getting started

# service postgresql initdb
to create /var/lib/pgsql/data which contains pg_hba.conf

createdb

set password for postgres user

psql -h -d -u -W

5/03/2014

crond edit

Format: minute hour day month weekday /path/to/script

Cron table takes time value as time point not interval.

Use * to ignore value.
# Run script at 4:03
3 4 * * * script

Use / to  specify interval
# run script every 14 minute
*/14 * * * script