Skip to content

Instantly share code, notes, and snippets.

@Edward-Lombe
Last active December 2, 2015 04:46
Show Gist options
  • Save Edward-Lombe/93b4d5df727f6eda63ef to your computer and use it in GitHub Desktop.
Save Edward-Lombe/93b4d5df727f6eda63ef to your computer and use it in GitHub Desktop.
var exec = require('child_process').exec;
// alternative ultra-short ECMA2015 version
// setInterval(a=>require('child_process').exec('git pull',(b,c,d)=>{console.log(b||c||d)}),6e4)
setInterval(function() {
exec('git pull', puts);
}, 60 * 1000);
function puts(error, stdout, stderr) {
console.log(error || stderr || stdout);
}
@Edward-Lombe
Copy link
Author

Usage

Place auto-pull.js into whatever directory git pull is normally run from. Vanilla ES5 with no external dependencies other than child_process from the node standard library, so it should run in most node environments. Change the value of the argument to the setInterval function in order to have the pulls more or less frequent, currently set to 60 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment