Archive for the ‘Linux’ Category

daemontools + mono + dream

Wednesday, December 23rd, 2009

daemontools is a wonderful alternative to using inittab or rc.d startup scripts on your favorite Linux and BSD boxes. I really like using it, but Im not here to sell you on it, simply to tell you how you can use it to keep your dream server going. I am going to use the 8-ball example from the mindtouch site for this example. First I like to go to the directory where I keep my dream app.

cd ~/8-ball/bin

This is the directory where my file is located. Next using my favorite $EDITOR I will


In this file I will add the following:

cd /home/errr/8-ball/bin &&
exec envuidgid www-data /usr/bin/mono script 8ball.startup.xml \
public-uri \
server-name \

Next save the file & set the script to be executable

chmod +x run

Now I will explain a couple of things here. First off the envuidgid is a command from daemontools so you may need to provide the full path to your file location of this if it is not in your $PATH. Second off is the IP flag. If you use an IP here from my testing then the host will only work when you type that IP. See more about that here:
Now you need to be root (or you can use sudo) for this next part. Head to your service directory. If you installed daemontools from source that is typically /service but if you are like me and use Debian/GNU Linux and used apt-get to install it then it will be located in /etc/service Simply change to the directory and symlink: | /home/errr | 16:38 |
» sudo -s
[sudo] password for errr: | /home/errr | 16:38 |
» cd /etc/service | /etc/service | 16:39 |
» ln -s /home/errr/8-ball/bin 8ball

From here its like any other new service we have ever added. svscan will automatically start the new service within 5 seconds. You can verify that its working with ps, svstat or by just hitting the URL directly. In my case you can see my example here

Slice Host

Tuesday, December 15th, 2009

So I got me a VPS the other day. I really missed having a Linux box at my disposal to test cool stuff with, or do what ever other really geeky things it is I do with Linux boxes. One of my buddies who happens to work at Rackspace just couldn’t say enough positive stuff about Slice Host and neither can I. As you may or may not know Slice Host is a Rackspace company (which means awesome everything!! support, stability, network speed…).This is a kick ass deal!! I currently have 2 256 slices. On one of them I am running tinydns for hosting my DNS (even though slice host will do that for me for free… what fun is that?),exim4 to host email for a few users (even though you get this super cheap offer from slice host to have rackspace host your email for you.. again what fun is that?), lighttpd to host some php sites (I am using SQLite for all my databases), and nagios to monitor some sites I like to keep an eye on. I also have that same machine setup for hosting Mono apps. One of which is Dream, a wonderful frame work I am very interested in right now. All this and I still have like 80M of free memory. Im not even sure what I am going to do with my new slice but Im sure it wont take me long to find some new cool thing I need to test out.

Debian Etch + Samba + Windows 2008 Active Directory Server + DekiWiki

Friday, February 13th, 2009

So I needed to install DekiWiki. I decided to just use the VMWare Image they supply. It uses Debian Etch as its OS. As with all of our other Linux server, I decided this one needed to join our Active Directory Domain. I went to google and did a search for how to connect Debian to AD. Well plenty of guides poped up so I followed them like I did for Ubuntu and for our CentOS machines. I got to the step of actually joining the domain and I got this crappy error:

ads_connect: Server not found in Kerberos database

Well after a trip to the Samba IRC support room I found out I needed a newer version of Samba and WinBind. A simple fix on Debian. By default the Backports repository is already in the sources list on this VMWare image that dekiwiki came on. So all I had to do was:

apt-get -t etch-backports install samba

Then a simple:

net ads join -U administrator -S -W MHIPRIV.COM

That rewarded me with:

Enter administrator’s password:
Using short domain name — MHI
Joined ‘WIKI2’ to realm ‘’

With a few more changes to a few other config files and I am now able to ssh to that box as any AD user.

Why doesnt Netflix want your money

Thursday, February 12th, 2009

Would it really have been to much trouble to use flash over silverlight? If they had used flash my Linux box would have no problems playing their movies. I installed the user agent switcher addon for my firefox, (since they check your u/a and reject you based on that) spoofed my browser to be firefox 3.0.5 running on an Intel Mac + I have Moonlight 1.0 installed and I was hoping to trick netflix into letting me play a movie on my linux box but no luck. Once I got past their stupid user agent checker it seems that you have to use silverlight 2.x to play a movie so my moonlight is useless; thanks netflix. They need to make that thing support anyone that has money and an internet connection that is fast enough to play the movie. Are they really doing so well in this economy that they can afford to turn business away?

Asterisk Dual Servers with SIP

Tuesday, July 15th, 2008

I have found about a million articles on the net for connecting 2 asterisk boxes using IAX2. What I have not found is many describing how to do this with SIP, so thats what Im going to talk about. Now since I am a FreePBX user I am going to talk about how to do this using the FreePBX web GUI. You can use this method if you use TrixBox, or Elastix, or PBX In A Flash, or if you just use FreePBX with your own distro.

I have 2 systems. To make this simple Im going to call them pbx1 (which for this example is in San Antonio) and pbx2 (which we will pretend is in our Houston office). First we need to log into the web interface on pbx1 and then get to the section where you configure trunks. Click Add SIP Trunk. Im not going to mess with any of the General Settings, or the Dial Rules. I am going to go straight to the Outgoing Rules. In trunk name Im going to call this trunk-hou-peer. Next I jump into the PEER Details box. I put the following into the box:


Next, Remove all the settings from the Incoming Section. Hit submit, and then apply the changes.

Next we need to log on the web gui for pbx2. Now we are going to go from Houston back to San Antonio with this trunk. We need to add a new SIP trunk here. Follow the same steps as before, but now name this trunk: trunk-sa-peer You may notice that the name of this trunk is the username we used in the peer details on pbx1. Now in the Peer details on pbx2 add the following:


Now you will notice that the username on this peer is what we named our trunk on pbx1. The context used in both is the same. This will give you access from pbx2 to dial an extension that is on pbx1 and vise versa. Now all we need to do is submit this and apply the changes.

Next all we need to do is create an outbound route to use our new trunk. For the sake of keeping it super simple lets assume you have extension 100-199 on pbx1 and 200-299 on pbx2. We need to go to the outbound route section and create a route on pbx1, name it toHouston and it needs a dial pattern that looks like this:


Click on the Intra Company Route. Then select our Houston trunk. Next submit and apply changes. Now head over to the pbx2 web gui and do the same steps only name this route toSanAntonio and for its dial pattern use:


Click Intra Company Route select the San Antonio Trunk, hit submit and apply. Now from extension 100 in San Antonio dial 200 and bamo thats it. You can take this a step further and even do toll-by-pass now.

The best course is to answer No and try again later.

Thursday, July 10th, 2008

I have been working on a Domain Controller at work using Samba 3.0.28 and openLDAP. I was trying to setup my windows client computers to login then map some drives from various other samba servers we have. My logon.bat file looked like this:

@echo off
net time \\ /set /y
net use h: /delete
net use h: “\\\homes”
net use g: /delete
net use g: “\\\apps”

This was working but causing some weird issues when you would log in from a windows client. I would get this error on windows that said:

There are open files and/or incomplete directory searches pending on the connection to

So I went over to microsoft google and did a search for the error. #1 google result led me here So I am reading and sure enough this is my problem. So then on to the answer.. WTF!!! You mean seriously you want me to wait and try it again.. Im thinking to my self “You have to be fu**ing kidding me” So I wait, and wait, and wait, and then went home for the day and then today I try again and still the same shit. So I decided to find the real solution. What happened is that in my smb.conf I set the logon drive = H: so samba was already mapping it for me and then I was trying to /delete it and then remap it, and somewhere in that process was the problem. All you really need to do is either set

logon drive =

Because the default drive is Z:\ if its not set, or

logon script = logon.bat
logon path = \\%L\PROFILES\%U
logon drive = H:
logon home = \\%L\%U

And make sure your logon.bat looks like this

@echo off
net time \\ /set /y
net use g: /delete
net use g: “\\\apps”

I hope someone out there finds this more useful than the “The best course is to answer No and try again later.” crap answer I found on the M$ site.

My New Cell Phone – Nokia n95 8GB

Tuesday, July 1st, 2008

Yeah, hate me.. I got one. Its so freakin awesome. here are a few things that really kick ass so far about this phone:

  • I am able to sync music to the phone via amarok using Linux
  • I am able to browse the web using WIFI or my 3g data service.
  • I have configured my n95 as a sip client and have it registered with my Asterisk server.
  • The phone supports mobile bar codes
  • The camera takes WONDERFUL pictures. The quality is very high!! And you can export them directly to flickr!!
  • The phone takes really great video
  • Did I mention I didnt need windows to add music to this thing??

Im sure there are other really great things about this phone too but I have only had it a couple days so I havent had time to check all the features out yet.

Centralized Voicemail server for multiple Asterisk systems using FreePBX and IAX2

Sunday, May 13th, 2007

Well I never really finished up my asterisk tips posts… I’m lazy and most of the free time I do have I dont like to spend on the computer anymore (what can I say). Im going to make it up to you though by sharing with you how to make a very slick asterisk setup.

So why would anyone want to have a stand alone voicemail server anyway?? Well thats pretty simple. Lets pretend you have a small to medium sized company. Maybe 100-500 employees, maybe more maybe less… You have 3 or 4 office locations, they span several cities or maybe even other states.. It doesnt really matter where they are. The important thing is that they all need to be connected. You need to be able to call from one office to another, and at times you will even need to forward voicemails from one location to another. Asterisk does not just automaticly support this. Even if you have routes in place that make it so you can call each person on your network with a SIP call if their voicemail box isnt on the same server as yours you cant forward them a message. This can become a big problem real fast. Infact at our company we were considering not using asterisk because of this. The good news is that its really simple to do.

First off Im not going to cover how to connect the multiple servers. This has been articled to friggin death. Its covered on many sites, one of them not being this one. Next Im going to assume you have figured out how to make connections from 1 asterisk system to another using IAX2. If not please check out this guide. It works great.

Now on to the fun stuff. I used FreePBX on our 3 PBX servers to get our dial plan setup and have a nice easy to manage user interface. I kept thinking that this would keep me from being able to customize my dial plan like i needed to but I was all wrong about that. Im now going to point you over to the guide I followed: Click me!!!

This guide is fairly good. It doesnt cover doing it with FreePBX though. If you use FreePBX you may have found that if you edit one of its config files you lost your changes once you entered the gui, or made an update to FreePBX. I went to the IRC and asked how to get around this. It was simple, at the top of the config files you see a line that says #include somefile_custom.conf All you have to do is edit that custom.conf file and over ride the context you need to edit. So if you have in your sip.conf file a [foo] context you go to sip_custom.conf and make [foo] in there and then the settings for the [foo] context from your sip_custom.conf file will be whats used instead of the [foo] from sip.conf

In the article I asked you to click to see how to do the setup it said you needed to edit a macro in extensions.conf. The context you need to edit is called [macro-vm] First what I did was copy and pasted the [macro-vm] context from extensions.conf and pasted it into extensions_custom.conf then I edited the following:

; over riding the below for our central voicemail server
exten => s-BUSY,n,Dial(IAX2/toVMail/b${ARG1})
exten => s-BUSY,n,Goto(exit-${VMSTATUS},1)

exten => s-DIRECTDIAL,1,NoOp(DIRECTDIAL voicemail)
exten => s-DIRECTDIAL,n,Macro(get-vmcontext,${ARG1})
; over riding the below for our central voicemail server
exten => s-DIRECTDIAL,n,Dial(IAX2/toVMail/${ARG1})
exten => s-DIRECTDIAL,n,Goto(exit-${VMSTATUS},1)

From there I just followed the rest of the guide the other nice fellow provided and saved my settings, then setup a plain jane asterisk server for my voicemail server. I didnt use FreePBX on it at all. Managing that server is braindead simple so I didnt see the need. I hope this little tidbit will help others out there who have to set this up.

Asterisk tips #1

Thursday, March 15th, 2007

I have been building an asterisk system at work for testing stuff. I started with a Fedora Core 6 box and then installed asterisk from source. Since we will be using a PRI we had to buy a T-1 card. We decided to go with sangoma. For our testing purpose we just got an A102. I installed the card and then went to the sangoma site for the latest wanpipe drivers. After installing them and setting up my zaptel.conf and zapata.conf I found nothing worked. I found out I needed to compile the wanpipe stuff first, and install zaptel from source instead of using the Fedora RPM because the wanpipe package needs to patch the zaptel stuff. Once I finished this and loaded the wanpipe modules and loaded ztdummy and then rebuilt asterisk I had a working sangoma card. I started with a very very basic config for asterisk. I just wanted to have 2 extensions and make them able to call each other using SIP, then I wanted to take 2 of the DID’s provided to me by our phone company and have them ring into the extensions. The SIP part of this was just plain simple. Here is what my sip.conf looks like for asterisk.

;Test Guy1

;Test Guy2

The important thing to note here is the context=local_test Next to get this working completely we need a very basic extension.conf file. Mine looks like this:

; SIP extensions
;Test Guy1
exten => 231,1,Dial(SIP/231)
;Test Guy2
exten => 205,1,Dial(SIP/205,10)
exten => 205,2,PlayBack(vm-goodbye)
exten => 205,3,HangUp()

Thats it, this simple example will now make it so from 231 we can dial 205 then if after 10 seconds we dont answer the phone system will automaticly pick up and play the message vm-goodbye.gsm and then hangup the phone. Remember I said to note the context=local_test Well in our extensions.conf file if we had named our context block something else it wouldnt have worked because the context wouldnt have matched. You can name your context blocks what ever you want, but keep in mind they must match or nothing will work.

Now we need to expand on this just a little bit to get our calls from the outside to ring in. I will cover that later today or Friday. Its very simple so check back soon for the tip.

The end of week 1

Friday, January 19th, 2007

Im still alive, and I still have a job. This job is really sweet. We use a lot of FreeBSD at work. We do use a little bit of linux, and I managed to get though a whole week using Fedora for my desktop. Im looking forward to a project I have been handed. I have to complete a pretty large router setup. It will all be run on some form of FreeBSD. Its a very challenging project that will test my abilities very well.I setup a wiki at work using media wiki. Its going to be for internal use only but will be used to document the router I am building, as well as most other aspects of my job and any one elses job who cares to document how to preform their job. I really like the people I work with, they are very sharp and I will be able to learn a whole lot from them.

This week has been really cold here in San Antonio. We had a hard freeze a couple days in a row and lots of places lost power (thankfully not me). I have found an H-E-B on just about every street corner. From my apartment there is like 2 in what I consider to be walking distance… I have looked around while I have been out driving around lost for other stores that we had in Odessa but I have not found anything other than WalMart. I guess H-E-B has run everyone else out of town… I really like the people I have met so far, although I havent met anyone out side of work… I pretty much stay home and play nintendo wii most of the time anyway. I joined a gym called anytime fitness. They are a 24hr gym. I like this because sometimes when I cant sleep the thing that will make me tired is tossing around some heavy weights or running a mile or so on the cross trainer. Im missing my little girl April very much and I wish she were able to be here…