Skip to content

Instantly share code, notes, and snippets.

@hukl
Created May 9, 2014 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hukl/664a7468720c63a92274 to your computer and use it in GitHub Desktop.
Save hukl/664a7468720c63a92274 to your computer and use it in GitHub Desktop.
example rc script
#!/bin/sh
# PROVIDE: request_counter
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name=request_counter
rcvar=request_counter_enable
pidfile="/var/run/${name}.pid"
procname="/usr/local/bin/ruby"
command="/usr/local/bin/ruby /usr/local/etc/nginx/req_per_second.rb"
start_cmd="consumer_start"
consumer_start(){
echo "starting ${name}"
/usr/sbin/daemon -f -r -p ${pidfile} -u deploy ${command}
}
load_rc_config $name
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment