Last active
December 2, 2015 04:46
-
-
Save Edward-Lombe/93b4d5df727f6eda63ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Place
auto-pull.js
into whatever directorygit pull
is normally run from. Vanilla ES5 with no external dependencies other thanchild_process
from the node standard library, so it should run in most node environments. Change the value of the argument to thesetInterval
function in order to have the pulls more or less frequent, currently set to 60 seconds.