Locating PostgreSQL data directory

Use a simple psql query to find the location of the data directory
postgres=# SHOW data_directory;
data_directory
------------------------------
/var/lib/postgresql/8.4/main
(1 row)

Or

postgres=# select setting from pg_settings where name = 'data_directory';
setting
------------------------------
/var/lib/postgresql/8.4/main
(1 row)

Posted in tips | Tagged | Leave a comment

Enable Thunderbird Global Search in Fedora

If you’ve just installed Thunderbird on Fedora 13, you’ve probably noticed the Global Search bar is missing. At least, this is one of the first things I noticed. After using Thunderbird 3.x for sometime on Windows I’ve really come to love this feature.

It seems the default configuration on Fedora doesn’t enable this feature by default, however it is simple to get working. Go to the Preferences menu, Advanced section and check “Enable Global Search and Indexer”. After this, restart Thunderbird and it will begin indexing your mail. After which, the Global Search should work as expected.

Posted in other, tips | Tagged , , | 1 Comment

Moving /home to new partition

If /home is just a folder under / and you have a reason to put this on it’s own partition the process isn’t that difficult. Here is the steps I followed to do this.

First, create the new partition on the drive. I was using LVM, so I created a new logical volume, do whatever makes sense for your system here.

Make a place for the new home partition to be mounted while we transfer files.

mkdir /mnt/newhome
mount -t   /mnt/newhome

Move files from current /home to this new location.

cd /home
cp -ax * /mnt/newhome

Once all the files have copied, remove the old home directory, and mount the new partition in its place.

rm -r /home
mount  -t   /home

Edit /etc/fstab for the new partition, and you’re done.

Posted in Uncategorized | Leave a comment

Lock and Unlock Linux accounts

Using passwd it is possible to quickly lock and unlock Linux accounts.

To lock an account.

passwd -l username

To unlock an account.

passwd -u username
Posted in tips | Leave a comment

Using telnet to test POP server

Using telnet (or putty) it’s possible to some simple tests against a POP server. By no means exhaustive, it can give you insights in where to start troubleshooting.

First, using telnet and open a connection the remote POP server

telnet mailserver 110

Where mailserver is the mail server you want to connect to. Note that port 110 is the default port for POP, but could be different depending on your servers settings.

Once connected, use USER and PASS to login.

[root@ms1 ~] # telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK POP3 localhost v2001.78rh server ready
USER username
+OK User name accepted, password please
PASS password
+OK Mailbox open, 1 messages
QUIT
+OK Sayonara
Connection closed by foreign host.
Posted in tips | Leave a comment

Linux IPv6 Neighbor Discovery

Using ping6 and ip neigh it’s possible to discover other IPv6 hosts on your local network using the link-local addresses.
First, use ping6 to ping all hosts on the local network using the IPv6 link-local address

ping6 -c 2 -I eth0 ff02::1

Then, use ip neigh to show a list of IPv6 enable hosts on the local network

ip -f inet6 neigh
Posted in quickfire, tips | Tagged | Leave a comment

Why use ZFS with FreeNAS?

I recently started using FreeNAS again after exploring other options that existed, such as openfiler, and now that I’ve returned, ZFS seems to be the cool thing to do.  After reading, watching videos and playing with ZFS I’m sold on all the features it offers.  However, I must ask, is there a compelling reason to use ZFS over UFS for a single disk?  I’d really like to see some comments on this.

Posted in quickfire, rants | Leave a comment

Rewrite incoming CallerID

We’re using asterisk, and as part of the dial plan, a 9 is required before the number to make calls out to the PSTN.  Since our phones have a incoming call log, it would be very convient to have asterisk rewrite the CallerID value on calls from the PSTN to include this leading digit.  I found this was rather easy to accomplish.  Adding something similar to the following to whatever extension handles your incoming calls, all CallerID numbers will have a 9 added to the front.

exten => s,1,Set(CALLERID(num)=9${CALLERID(num)})

And proceed with your normal call routing logic. Change the preceding digit to whatever matches your system.  If you have several extensions this is going to be used with, you could benefit from using a global variable for the leading digit.

Posted in quickfire, tips | Tagged | Leave a comment

Share list of files in DropBox Public folder

For Windows DropBox users. Here is a simple way to share list of links for your Public folder. This script doesn’t show files in sub-directories.

1. Create a makefilelist.bat file with script to list all files in directory.
2. Use Scheduled Tasks to run the .bat file Daily or Weekly, etc as needed; depending on how often you update files in DropBox Public.
3. Share the list file with “Copy Public Link”.
4. Open Public Link in a browser. You know have a list of all public files that is up-to-date.

You can see an example and download the makefilelist.bat file here:
http://dl.dropbox.com/u/4355901/index.html

GitHub:
http://github.com/drale/dropboxlistpublic/

Posted in quickfire | Tagged | 5 Comments

Asterisk GotoIf Application

The description from asterisk for this is GotoIf(condition?[labeliftrue]:[labeliffalse]), however for me (being somewhat new to asterisk, and not fully understanding all the little bits, this was a bit confusing. A better way of describing this, at least for those of use new to asterisk, might be GotoIf(condition?[context,priority,labeliftrue]:[context,priority,labeliffalse]).
I have not used labels in the dial plan before, and when starting out with this application I read label to be a context. This lead me to write my dial plan similar to this..

[default]
exten => 100,1,GoToIf(condition?true,false)
[true]
exten => s,1,...
[false]
exten => s,1,...

In retrospect, it’s obvious what the documentation is saying, but as I said, not being familiar with labels, I was a bit lost.

Posted in quickfire, tips | Tagged | Leave a comment