If anyone is interested in making FreePBX play nicely with ubuntu I have to created an upstart script. To follow their logic I had to make some changes to the freepbx_engine script (called with an extra parameter passed across from the amportal script). This was created against Ubuntu 12.04 and FreePBX 2.10. There was also a requirement to modify the safe_asterisk script to not fork i.e. set AST_BACKGROUND=0 (or whatever... sorry I may have forgoten by now). As a side note the freepbx_engine script crashes out with a fatal error if MySql? isn't running. This was a bit difficult to track down as there is no obvious error message. Also due to the asynchronous nature of upstart adding amportal start to rc.local is not a guaranteed fix (it would not of worked reliably on my box without adding a delay of some sort) and the sys v init script did not work at all because of the same reasons. There are other ways to make this work of course but the upstart script seems to be the most Ubuntu compatible way. There also seem to be a lot of negative comments about working with PID files made by the upstart team (they don't support them and discourage using them all together). Ideally I'm sure they'd want the whole thing rewritten as a pure upstart job but who has the time for that?