Permalink
Browse files

Cleaned up the Upstart script.

  • Loading branch information...
hectcastro committed Apr 10, 2012
1 parent fd08d3f commit 18f54d7da4d8ba37c15406c0646e06d13e18f2f2
Showing with 11 additions and 23 deletions.
  1. +3 −12 recipes/default.rb
  2. +0 −4 templates/default/start.erb
  3. +8 −7 templates/default/statsd.conf.erb
View
@@ -23,21 +23,12 @@
notifies :restart, "service[statsd]"
end
-directory "#{node["statsd"]["dir"]}/scripts" do
- action :create
-end
-
-template "#{node["statsd"]["dir"]}/scripts/start" do
- source "start.erb"
- mode 0755
- variables(
- :log_file => node["statsd"]["log_file"]
- )
-end
-
template "/etc/init/statsd.conf" do
mode "0644"
source "statsd.conf.erb"
+ variables(
+ :log_file => node["statsd"]["log_file"]
+ )
end
user "statsd" do
@@ -1,4 +0,0 @@
-#!/bin/bash
-# Called by Upstart, /etc/init/statsd.conf
-
-/usr/local/bin/node /usr/share/statsd/stats.js /etc/statsd/config.js 2>&1 >> <%= @log_file %>
@@ -1,11 +1,12 @@
-description "statsd"
+description "StatsD"
author "Chef"
-start on startup
-stop on shutdown
+start on runlevel [2345]
+stop on runlevel [!2345]
-script
- export HOME="/root"
+respawn
+expect daemon
- exec sudo -u statsd /usr/share/statsd/scripts/start
-end script
+exec start-stop-daemon --start --oknodo --chdir /usr/share/statsd --user statsd --chuid statsd --name statsd --startas /usr/local/bin/node --background -- /usr/share/statsd/stats.js /etc/statsd/config.js 2>&1 >> <%= @log_file %>
+
+emits statsd-running

0 comments on commit 18f54d7

Please sign in to comment.