Permalink
Browse files

Merge branch 'feature/dashboard' of github.com:jeffsu/upbeat into fea…

…ture/dashboard
  • Loading branch information...
jeffsu committed Sep 11, 2012
2 parents c883036 + 62609bd commit bfac4c0f2af9f36bb939fc6cc22a5f1bbd9e9cdc
Showing with 20 additions and 1 deletion.
  1. +20 −1 lib/strategies/pidfile.ms
  2. BIN www/public/images/shortcut.psd
View
@@ -1,4 +1,23 @@
+var exec = require('child_process').exec;
+var fs = require('fs');
+
module.exports = #(options) {
- // open file, check to see if pid exists
+ var pidfile = options.pidfile;
+ var exec = require('child_process').exec;
+ var fs = require('fs');
+
+ return #(cb) {
+ fs.readFile(pidfile, #(err, pid) {
+ if (err) return cb('error opening file');
+
+ var command = 'ps -p ' + pid.toString().trim() + ' -o comm=';
+ exec(command, process.env, #(err, stdout, stderr) {
+ if (err) return cb(err);
+ var pass = stdout.toString().match(/\n/);
+ if (!pass) cb('process not running');
+ else cb();
+ });
+ });
+ }
};
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bfac4c0

Please sign in to comment.