From abe8ae27a35accea68093f067cbf349d2845615a Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Mon, 15 Mar 2010 01:33:50 +0000 Subject: [PATCH] Launch Asterisk on Mac OS X with launchd. Reviewboard: https://reviewboard.asterisk.org/r/551/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@252361 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- Makefile | 2 + contrib/init.d/org.asterisk.asterisk.plist | 47 ++++++++++++++++++++++ main/asterisk.c | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 contrib/init.d/org.asterisk.asterisk.plist diff --git a/Makefile b/Makefile index c235f42b29..3487813c69 100644 --- a/Makefile +++ b/Makefile @@ -691,6 +691,8 @@ config: elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \ $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk $(DESTDIR)/etc/init.d/asterisk; \ if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \ + elif [ -d $(DESTDIR)/Library/LaunchDaemons -a ! -f $(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist ]; then \ + $(INSTALL) -m 644 contrib/init.d/org.asterisk.asterisk.plist $(DESTDIR)/Library/LaunchAgents/org.asterisk.asterisk.plist; \ elif [ -f /etc/slackware-version ]; then \ echo "Slackware is not currently supported, although an init script does exist for it."; \ else \ diff --git a/contrib/init.d/org.asterisk.asterisk.plist b/contrib/init.d/org.asterisk.asterisk.plist new file mode 100644 index 0000000000..a0c87e8359 --- /dev/null +++ b/contrib/init.d/org.asterisk.asterisk.plist @@ -0,0 +1,47 @@ + + + + + Label + org.asterisk.asterisk.launchagent + Disabled + + UserName + asterisk + GroupName + asterisk + OnDemand + + KeepAlive + + RunAtLoad + + Umask + 432 + Program + /usr/local/sbin/asterisk + ProgramArguments + + /usr/local/sbin/asterisk + -f + + EnvironmentVariables + + TERM + xterm-color + + SoftResourceLimits + + NumberOfFiles + 1024 + Core + 0 + + StandardInPath + /dev/null + StandardOutPath + /dev/null + StandardErrorPath + /dev/null + + diff --git a/main/asterisk.c b/main/asterisk.c index 5730bc6fe4..14dbd9a38e 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -3030,7 +3030,7 @@ int main(int argc, char *argv[]) } else ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", ast_config_AST_PID, strerror(errno)); #else - ast_log(LOG_WARNING, "Mac OS X detected. Use '/sbin/launchd -d' to launch with the nofork option.\n"); + ast_log(LOG_WARNING, "Mac OS X detected. Use 'launchctl load /Library/LaunchDaemon/org.asterisk.asterisk.plist'.\n"); #endif } #endif