Last active
March 16, 2016 13:17
-
-
Save jmjuanes/dc15b53a23ddc711d988 to your computer and use it in GitHub Desktop.
Revisions
-
jmjuanes revised this gist
Mar 16, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ //Configuration var rclone = '/Users/jmjuanes/bin/rclone'; //Rclone path var exclude = '/srv/.bin/gbackup_exclude.txt'; //Exclude file var command = '{rclone} sync {origin} gdrive:{remote} --exclude-from {exclude}'; //RClone command //Import dependencies -
jmjuanes created this gist
Mar 11, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ #!/usr/bin/env node //Remember to make the script executable //chmod u+x gbackup.js //Configuration var rclone = '/Users/jmjuanes/bin/rclone'; //Rclone path var exclude = '/srv/_bin/gbackup_exclude.txt'; //Exclude file var command = '{rclone} sync {origin} gdrive:{remote} --exclude-from {exclude}'; //RClone command //Import dependencies var execSync = require('child_process').execSync; var fs = require('fs'); var path = require('path'); //Read the gbackup file var gson = require(path.join(process.cwd(), 'gbackup.json')); //Exclude file content var file = ''; //Build the exclude file for(var i = 0; i < gson.exclude.length; i++){ file = file + gson.exclude[i] + '\n'; } //Save the file fs.writeFileSync(exclude, file); //Replace the rclone path command = command.replace(/{rclone}/g, rclone); //Replace the origin path command = command.replace(/{origin}/g, process.cwd()); //Replace the remote path command = command.replace(/{remote}/g, gson.remote); //Replace the exclude path command = command.replace(/{exclude}/g, exclude); //Show command in console console.log(command); //Run the command execSync(command); //Remove the exclude file fs.unlinkSync(exclude); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ { "remote": "path/", "exclude": [ ".git/**", ".gitignore", ".gitmodules", "node_modules/**", ".DS_Store" ] }