Recently in System / Network Administration Category

If you have ever setup an asterisk box then you know some changes are in the configuration. One of those challenges is being behind a nat or router. The issue usually arises when you use the ivr and you dont receive DTMF tones to your ivr. I use ViaTalk for service and their support staff clued me into the problem. I had to externhost=my.dyndns.com in your sip_nat.conf does not solve this problem, or at least didnt for me so I had to write my own dynamic dns update script using php only because it was quick but you can do this is bash probably just as easily.


Simple Bulk rename : A Bash file rename script

| No Comments

often I have to rename a whole set of files that have not processed correctly, to do this I rename them with Bash, a simple script to do this is :

for f in *_3; do mv "$f" "${f/_3/_0}"; done

this renames all files ending in _3 to the same filename but now ending in _0

Freebsd PHP ports tree

| No Comments

So I have noticed that from time to time the /usr/ports/lang/php5-extensions versions get out of sync, to fix this its as simple as just removing the config (make rmconfig [only if you want to add more modules]) and rebuilding make install -DFORCE_PKG_REGISTER

X11 Display on Vista with ssh

| No Comments

Need an X11 interface that works quickly and for free... install Cygwin with X11 and openssh.... then make sure your ssh on your remote host has X11forwarding=yes.

from your bash shell in cygwin type startx a x11 xterm will come up and type:

DISPLAY=localhost:0.0 ssh -Y remotehost


you set... then any remote x app will appear on your desktop

Stderr .... output to grep

| No Comments

When you use some program like spamassassin, you will notice that the debug information :

spamassassin -D --lint

goes to stderr ... so you cant use grep as straight forward as you want. Here is how to pipe it to grep in bash:

spamassassin --lint -D 2>&1 | grep ....

or spamassassin --lint -D > output.txt 2>&1

to pipe it to a file first.

Disk Hog on Unix

| No Comments

So it often comes to the time to find what is taking all the space on your hard drive and like many things in unix, this isnt so straight forward, du (disk usage) will tell you how to do this, here will show you your top ten offending directories:

du -ha / | sort -n -r | head -n 10

du -ha = disk usage in human readable format ( lowest to highest )
sort -n -r = reverse the order
head -n 10 = top ten

| = pipe the output to the next command

I wrote this simple script to check if a process is running and if not restart it