diff --git a/config/carbon b/config/carbon index 7b5ef4a..22216cd 100755 --- a/config/carbon +++ b/config/carbon @@ -16,16 +16,17 @@ touch /var/lock/carbon GRAPHITE_HOME=/opt/graphite CARBON_USER=www-data +PIDFILE=/var/run/carbon/carbon.pid # Carry out specific functions when asked to by the system case "$1" in start) echo "Starting script carbon " - su $CARBON_USER -c "cd $GRAPHITE_HOME"; su $CARBON_USR -c "$GRAPHITE_HOME/bin/carbon-cache.py start" + su $CARBON_USER -c "cd $GRAPHITE_HOME && $GRAPHITE_HOME/bin/carbon-cache.py --pidfile $PIDFILE start" ;; stop) echo "Stopping script carbon" - su $CARBON_USER -c "cd $GRAPHITE_HOME"; su $CARBON_USR -c "$GRAPHITE_HOME/bin/carbon-cache.py stop" + su $CARBON_USER -c "cd $GRAPHITE_HOME && $GRAPHITE_HOME/bin/carbon-cache.py --pidfile $PIDFILE stop" ;; *) echo "Usage: /etc/init.d/carbon {start|stop}" diff --git a/fabfile.py b/fabfile.py index 05269dc..2712baf 100644 --- a/fabfile.py +++ b/fabfile.py @@ -109,6 +109,9 @@ def graphite_install(): with cd('/opt/graphite/conf/'): sudo('cp carbon.conf.example carbon.conf') sudo('cp storage-schemas.conf.example storage-schemas.conf') + # setting carbon pid folder and permissions + sudo('mkdir -p /var/run/carbon') + sudo('chown -R www-data: /var/run/carbon') # starting uwsgi sudo('supervisorctl update && supervisorctl start uwsgi')