Skip to content

Instantly share code, notes, and snippets.

@alchemycs
Created August 20, 2014 00:51
Show Gist options
  • Save alchemycs/d2b05333666e00569ee3 to your computer and use it in GitHub Desktop.
Save alchemycs/d2b05333666e00569ee3 to your computer and use it in GitHub Desktop.
Run repository scripts in AWSBOX from cron or shell with environment variables
#!/usr/local/bin/node
//quick and dirty to get my scripts going quickly on awsbox from cron. Will clean this up some other time.
var path = require('path');
var child_process = require('child_process');
var configFile = path.join(process.env['HOME'], 'config.json');
var config = require(configFile);
var env = config.env;
console.log('command: ',process.argv[2]);
child_process.exec('coffee '+process.argv[2] , { env: config.env }, function(e, stdout, stderr) {
console.log('Complete');
console.log('Error: ', e);
});
//console.log(config.env);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment