Disable auto fsck
Mon, 04/13/2009 - 11:30 — sandipI have a huge external usb drive set to be auto-mounted during backup processes and did not want to run fsck on every mount. With the below setting it would completely turn off the auto fsck check.
# tune2fs -c 0 -i 0 </dev/partition>
However, I would highly suggest atleast doing a regular 6 months check if not doing manual fscks.
# tune2fs -c 0 -i 6m </dev/partition>
PostgreSQL 8.3 install on CentOS
Wed, 04/01/2009 - 23:37 — sandip# wget http://yum.pgsqlrpms.org/repor pms/8.3/pgdg-centos-8.3-6.noar ch.rpm
# rpm -Uvh pgdg-centos-8.3-6.noarch.rpmr /># yum install postgresql-server
# service postgresql initdb
# service postgresql start
vzdump LVM snapshots kernel errors
Tue, 03/31/2009 - 09:49 — sandipOn running daily lvm snapshot backups via vzdump on OpenVZ servers, I noticed the below Kernel errors in logwatch reports.
WARNING: Kernel Errors Present
Buffer I/O error on device dm-4, ...: 22 Time(s)
EXT3-fs error (device dm-4): e ...: 60 Time(s)
lost page write due to I/O error on dm-4 ...: 22 Time(s)
This would show up on busy servers only, probably caused due to lvm snapshot running out of space.
I edited "/usr/bin/vzdump" and increased the size from 500m to 1000m which seems to have resolved the issue for now.
run_command (\*LOG, "$lvcreate --size 1000m --snapshot --name vzsnap /dev/$lvmvg/$lvmlv");
svn checkout via shell script
Mon, 03/30/2009 - 23:19 — sandipVery often development servers only have self-signed certificate for ssl connection. I've recently had to create a script that would checkout from a https svn repository that would fail with "Server certificate verification failed: issuer is not trusted..." . Below is a workaround used to temporarily trust the certificate.
svn --username $SVN_USER --password $SVN_PASS --no-auth-cache checkout ${REPO_URL}/${REPO_PATH} $REPO_PATH <<EOF 2>/dev/null
t
EOF
Testing zipped archives
Fri, 03/27/2009 - 08:52 — sandipIf you've got a lot of zip files and need to test it, here's a one liner that can be used to quickly validate the archives:
for x in `ls` ; do zip -T $x ; done | tee /tmp/archive_test.log
comparing files line by line
Thu, 03/26/2009 - 22:48 — sandipHere's a way to compare two files that have common lines in both files:
sort file1.txt > file1_sorted.txt
sort file2.txt > file2_sorted.txt
comm -12 file1_sorted.txt file2_sorted.txt
Note: files need to be sorted first prior to comparing.
cofigure phplist spellcheck for firefox
Thu, 03/05/2009 - 11:54 — sandipPHPList comes with FCKeditor as the gui default editor. However, by default it is setup so that the spellcheck is only available to IE users. To enable for other browsers such as Firefox, follow the below directions:
-
Edit admin/fckphplist.php:
Replace all instances of:
FCKConfig.SpellChecker &n bsp; = 'ieSpell' ;
with:
FCKConfig.SpellChecker &n bsp; = 'SpellerPages' ;
If this is a linux box, then make sure aspell is installed. Edit "admin/FCKeditor/editor/dialog
$aspell_prog = '/usr/bin/aspell';
That should do it.
Backup, restore and cloning of partition table
Tue, 02/03/2009 - 16:34 — sandipTo backup partition table:
sfdisk -d /dev/sda > sda.table
To restore the partition table:
sfdisk /dev/sda < sda.table
To clone partition table:
sfdisk -d /dev/sda | sfdisk /dev/sdb
set_loginuid failed opening loginuid
Tue, 02/03/2009 - 10:51 — sandipIf this file doesn't exist:
/proc/<pid of crond>/loginuid
It's because the kernel doesn't have AUDIT enabled. So you get a bunch of errors in "/var/log/secure" with "set_loginuid failed opening loginuid".
Recompile kernel with audit support:
CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y
If recompiling of kernel is not an option then:
Comment the below lines from all pam.d files.
session required &nbs p; pam_loginuid.so
Find files via:
# grep -l pam_loginuid.so /etc/pam.d/*
/etc/pam.d/atd
/etc/pam.d/crond
/etc/pam.d/login
/etc/pam.d/remote
/etc/pam.d/sshd
Loss in network connectivity on OpenVZ host
Thu, 01/29/2009 - 16:30 — sandipI was seeing loss in network connectivity when an OpenVZ container is stopped and noticed that the bridge mac address was taking the mac address of an existing containers virtual network interface instead of the physical interface.
The solution was to set the bridge mac address to the physical interface:
/sbin/ifconfig br0 hw ether $(ifconfig eth0 | awk '{print $5; exit}')
Here is what my "/etc/sysconfig/vz-scripts/vps