Below are one liners to clean out all comment and blank lines with grep and sed, usually in config files.
grep -v "^#\|^$" <conf_file>
or
grep -v "^\#" <conf_file> | sed '/^$/d'
BlogsClean up config filesSubmitted by sandip on Tue, 10/12/2010 - 21:53Below are one liners to clean out all comment and blank lines with grep and sed, usually in config files. grep -v "^#\|^$" <conf_file> or grep -v "^\#" <conf_file> | sed '/^$/d' »
Enabling md5 shadow password with authconfigSubmitted by sandip on Sat, 10/02/2010 - 14:44If you notice that /etc/shadow file password is using DES encryption, MD5 encryption can be enabled via: authconfig --enablemd5 --enableshadow --update If authconfig is not present edit, "/etc/pam.d/system-auth" and add "md5 shadow" to line starting with "password sufficient pam_unix.so" so it looks like below: password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok »
Migrating Sendmail Mail ServerSubmitted by sandip on Sat, 10/02/2010 - 00:13Below is how I have migrated mail server with minimum downtime and routing mail to the new server via mailertable, if IP is still pointing to the old server and has not resolved for some ISPs.
Prepare for the migration, rsycing the mail spool folder and the user home mail folders. rsync --progress -a -e "ssh -i /root/.ssh/key -p 22" old.mailserver:/var/spool/mail/ /var/spool/mail/ Run rsync the final time. Setup Sendmail with mailertable to relay mail coming in to the old server over to the new mail server. This is a similar setup for secondary mail servers. Add "FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl" to "/etc/mail/sendmail.mc" if it does not already exist. Create "/etc/mail/mailertable" file with contents of the routing table: domain.tld esmtp:[xxx.xxx.xxx.xxx] The square brackets skips checking MX records, so IP can be used instead. Remove domain name from "/etc/mail/local-host-names" so mails do not get delivered locally. Edit "/etc/mail/access" to relay mail for the domain. TO:domain.tld RELAY cd /etc/mail Test by telneting to port 25 on the old servers' IP and sending email. This should get relayed over to the new server. Use a new subdomain and redirect existing webmail url to the new server. »
Check glue record for domainSubmitted by sandip on Tue, 09/14/2010 - 08:56If you've just made any changes to the nameservers, you can verify if this has propagated at the root level. Check root servers for the corresponding tld first. So for .com domains: dig ns com The output is as below: ;; ANSWER SECTION: Now query the root servers for the corresponding domain: dig ns edices.com @g.gtld-servers.net The additional section from the result with the IP address show the glue records. ;; AUTHORITY SECTION: »
Speed up SSHSubmitted by sandip on Thu, 09/09/2010 - 17:04Try setting up ssh client with compression and use arcfour/blowfish encryption instead. Also avoid ipv6 lookup and reuse connections using Add below to ~/.ssh/config Host * »
Troubleshooting device or resource busySubmitted by sandip on Tue, 09/07/2010 - 15:40In order to extend an lvm partition, I had to unmount the mounted volume. When I tried to umount the volume, it complained about device being busy. When I tried to find the process using the device with, `fuser -m /dev/vg0/lv0` it returned nothing. So did a lazy umount with: umount -l /dev/vg0/lv0 However, after extending the partition with lvextend and running e2fsck on the volume, it then complained that the device was still busy and failed to check the volume. I then realized that most probably caused by nfs mounts. Once I stopped the nfs service, I was successfully able to check the volume. »
vzdump of CentOSSubmitted by sandip on Sun, 08/29/2010 - 15:01Current versions of vzdump has dependency for cstream and perl-LockFile-Simple, both available via rpmforge. Below is how I got it to install and run on CentOS-5.5 x86_64 architecture. wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm It's necessary to export the location of the PVE libraries that vzdump requires. This can be added to ".bash_profile": export PERL5LIB=/usr/share/perl5/ »
Run process with least cpu and IO prioritySubmitted by sandip on Tue, 08/24/2010 - 14:38Below is command to run process with the least CPU and IO priority. nice -n 19 ionice -c 3 <command> You could also include the same in the beginning of the script: #!/bin/bash References: »
easy php-fpm install via yumSubmitted by sandip on Tue, 08/10/2010 - 14:10On CentOS, php-fpm can be easily installed via CentALT yum repository. This requires epel repository too and will pull down any dependencies if needed.
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm rpm -Uvh http://centos.alt.ru/repository/centos/5/x86_64/centalt-release-5-3.noarch.rpm yum --enablerepo=CentALT --enablerepo=epel install php-fpm The default settings should work quite well. Bring up the service via: /etc/init.d/php-fpm start expect script for ssh password promptSubmitted by sandip on Fri, 07/16/2010 - 10:15Below is a sample expect script to handle ssh password prompt should you not get the ssh keys to be working between hosts: #!/usr/bin/expect -f »
|
User loginRecent blog posts
Who's onlineThere are currently 0 users and 7 guests online.
|