aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/upstart
diff options
context:
space:
mode:
authortzafrir <tzafrir@f38db490-d61c-443f-a65b-d21fe96a405b>2009-10-27 22:10:38 +0000
committertzafrir <tzafrir@f38db490-d61c-443f-a65b-d21fe96a405b>2009-10-27 22:10:38 +0000
commit5b11a7ce6e68371ea86491d90ce3ef86d7245056 (patch)
treedbfed44b549e2a958c08c9e02be13826116f3528 /contrib/upstart
parent7c92d5993c3e742299bd7502a444cfb29bc2ef0d (diff)
another variation of the upstart script
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@226227 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'contrib/upstart')
-rw-r--r--contrib/upstart/asterisk.user.conf44
1 files changed, 44 insertions, 0 deletions
diff --git a/contrib/upstart/asterisk.user.conf b/contrib/upstart/asterisk.user.conf
new file mode 100644
index 000000000..00fecd855
--- /dev/null
+++ b/contrib/upstart/asterisk.user.conf
@@ -0,0 +1,44 @@
+# asterisk
+#
+# Upstart control file for the Asterisk PBX
+#
+# To install, rename this file to 'asterisk' and copy it to /etc/event.d/
+# On Debian: copy to /etc/init/
+#
+# To start asterisk manually:
+# sudo start asterisk
+#
+# To stop asterisk manually:
+# sudo stop asterisk
+#
+# Asterisk is started with an "interactive console", though redirected
+# to/from /dev/null . The concept of a main console is bad. OTOH, the main
+# process should not detach from the console if we work with upstart and
+# alike.
+#
+# The username 'asterisk' is currently hardwired here, and likewise the
+# varrundir.
+#
+
+description "Asterisk PBX"
+#version "1.6.3"
+
+start on runlevel [2345]
+stop on runlevel [!2345]
+
+pre-start script
+ # Since Ubuntu clears /var/run on reboot, create this before we try to start
+ if [ ! -d /var/run/asterisk ]; then
+ mkdir -p asterisk /var/run/asterisk
+ chown asterisk: /var/run/asterisk
+ fi
+end script
+
+#console output
+respawn
+exec /usr/sbin/asterisk -U asterisk -g -f
+
+post-stop script
+ # Might as well clean up after ourselves, too.
+ rm -rf /var/run/asterisk
+end script