Created
October 19, 2010 21:29
-
-
Save benlangfeld/635163 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Adhearsion, open source collaboration framework | |
# | |
# Init Script | |
# Copyright (c) 2010 Ben Langfeld - [email protected] | |
# All rights reserved. | |
# | |
# Author: Ben Langfeld, 2010 | |
# | |
# /etc/init.d/adhearsion | |
### BEGIN INIT INFO | |
# Provides: adhearsion | |
# Required-Start: $network | |
# Required-Stop: | |
# Default-Start: 3 5 | |
# Default-Stop: 0 1 2 6 | |
# Short-Description: Adhearsion app daemon | |
# Description: Adhearsion telephony application | |
### END INIT INFO | |
APP_PATH = File.dirname(__FILE__) | |
APP_NAME = APP_PATH.split('/').last | |
PID_FILE = "#{APP_PATH}/adhearsion.pid" | |
def start | |
puts "Starting adhearsion app at #{APP_NAME} " | |
exec "start_daemon /usr/bin/env/ahn start daemon --pid-file #{PID_FILE} #{APP_PATH}" | |
end | |
def stop | |
puts "Shutting down adhearsion app at #{APP_NAME} " | |
exec "killproc /usr/bin/env/ahn -p #{PID_FILE} -TERM" | |
end | |
case ARGV.first | |
when "start" | |
status = start | |
exit status | |
when "stop" | |
status = stop | |
exit status | |
when "restart" | |
stop | |
status = start | |
exit status | |
else | |
## If no parameters are given, print which are avaiable. | |
puts "Usage: #{APP_NAME} {start|stop|restart}" | |
exit | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment