| 1 | # asterisk |
| 2 | # |
| 3 | # Upstart control file for the Asterisk PBX |
| 4 | # |
| 5 | # To install, rename this file to 'asterisk' and copy it to /etc/event.d/ |
| 6 | # On Debian: copy to /etc/init/ |
| 7 | # |
| 8 | # To start asterisk manually: |
| 9 | # sudo start asterisk |
| 10 | # |
| 11 | # To stop asterisk manually: |
| 12 | # sudo stop asterisk |
| 13 | # |
| 14 | # Asterisk is started with an "interactive console", though redirected |
| 15 | # to/from /dev/null . The concept of a main console is bad. OTOH, the main |
| 16 | # process should not detach from the console if we work with upstart and |
| 17 | # alike. |
| 18 | # |
| 19 | # The username 'asterisk' is currently hardwired here, and likewise the |
| 20 | # varrundir. |
| 21 | # |
| 22 | |
| 23 | description "Asterisk PBX" |
| 24 | #version "1.8" |
| 25 | |
| 26 | start on runlevel [2345] |
| 27 | stop on runlevel [!2345] |
| 28 | |
| 29 | pre-start script |
| 30 | # Since Ubuntu clears /var/run on reboot, create this before we try to start |
| 31 | if [ ! -d /var/run/asterisk ]; then |
| 32 | mkdir -p asterisk /var/run/asterisk |
| 33 | chown asterisk: /var/run/asterisk |
| 34 | fi |
| 35 | end script |
| 36 | |
| 37 | #console output |
| 38 | respawn |
| 39 | exec /usr/sbin/asterisk -U asterisk -g -f |