Okay, so you've got FreeSWITCH downloaded, compiled, installed, configured, and tested. Now, how do you make it run automatically whenever you boot up your system, shut it down cleanly when you shut down your system, and use the console while it's running?

Update (20080917): I've actually added another setup, which you can find in my daemontools run scripts section. I think the other setup is a little more interesting, in that it gets you tracelogs from GDB whenever FreeSWITCH crashes.

Well, as it turns out, there's at least one simple option; you'll need daemontools and GNU Screen to make it work.

  1. Install daemontools.
  2. Install GNU Screen.
  3. mkdir /services
    mkdir /services/freeswitch
    mkdir /services/freeswitch/log
    ed /services/freeswitch/run
    a
    exec screen -D -m -S freeswitch /usr/local/freeswitch/bin/freeswitch
    .
    wq
    chmod a+x /services/freeswitch/run
    ed /services/freeswitch/log/run
    a
    exec cat > /dev/null
    .
    wq
    chmod a+x /services/freeswitch/log/run
    ln -sf /services/freeswitch /service/
       
  4. During the next 5 seconds, FreeSWITCH should start up.
  5. To see what's going on, do screen -x freeswitch and when you're done looking, press CTRL-A and then CTRL-D to go back to whatever you were doing without disturbing FreeSWITCH.
  6. To restart FreeSWITCH, do freeswitch -kill or svc -t /service/freeswitch.