issue with upstart job for statsd

1.4k views Asked by At

I am using the following statsd.conf file in my /etc/init directory (and sudo start statsd) to launch statsd. When I run sudo start statsd, I receive the error posted below the conf file. Any ideas on how to troubleshoot/resolve this would be greatly appreciated.

/etc/init/statsd.conf

#!upstart
description "Statsd node.js server"

start on startup
stop on shutdown

script
    export HOME="/root"

    echo $$ > /var/run/statsd.pid
    exec sudo -u www-data node /home/username/anotherDir/statsd/stats.js /home/userName/anotherDir/statsd/localConfig.js  >> /var/log/statsd.log 2> /var/log/statsd.error.log
end script

pre-start script
    # Date format same as (new Date()).toISOString() for consistency
    echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /var/log/statsd.log
end script

pre-stop script
    rm /var/run/statsd.pid
    echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /var/log/statsd.log
end script

Error Message:

fs.js:1051
    throw errnoException(process._errno, 'watch');
          ^
Error: watch ENOENT
    at errnoException (fs.js:1019:11)
    at FSWatcher.start (fs.js:1051:11)
    at Object.fs.watch (fs.js:1076:11)
    at new Configurator (/home/username/anotherDir/statsd/lib/config.js:26:6)
    at Object.exports.configFile (/home/username/anotherDir/statsd/lib/config.js:36:16)
    at Object.<anonymous> (/home/username/anotherDir/statsd/stats.js:146:8)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
2

There are 2 answers

0
ali haider On BEST ANSWER

Pilot error - the config file was named config.js and not localConfig.js.

1
verybadalloc On

The error ENOENT is caused by a file not found. I would double-check your stats.js script