-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcron_gitpull_node.js
43 lines (35 loc) · 1.95 KB
/
cron_gitpull_node.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// ##### ==============================================================================
// ##### This script provides the cron for the (git pull)
// ##### It is designed to be applied one a week, or once every forthnight to bring
// ##### contents from the GitHub. Therefore, the results can be generated externally,
// ##### and transferred to GitHub periodically, while this script updates the EndPoint
// ##### ==============================================================================
// ##### Comment about meta and source of input data
// ##### Name: cron_gitpull_node.js
// ##### Purpose: To pull contents from the GitHub into Toolforge
// ##### Authors: https://github.com/InvasionBiologyHypotheses
// ##### Version: unknown and in progress
// ##### Version-date: 00/00/0000
// ##### Additional comments: N/A
// ##### ==============================================================================
// ##### Comment for initialisation
// ##### Note: This script is to run directly with NODE.
// ##### Note: This script is prepared for (cron), but cron was not here implemented because
// ##### DENO options is considred (cron_gitpull_deno.js).
// ##### COMMAND @ anywhere: $ node test1.js (if node is added to path)
// ##### ==============================================================================
// ###########################################
// ##### Import required modules (START) #####
// ###########################################
const execSync = require('child_process').execSync;
// import { execSync } from 'child_process'; // replace ^ if using ES modules
// #########################################
// ##### Import required modules (END) #####
// #########################################
try {
const command2_string = 'git init; git status; git pull;';
const command2 = execSync(command2_string, { encoding: 'utf-8' }); // the default is 'buffer'
console.log('return:\n', command2);
} catch(err) {
console.log('return:\n', 'failed');
}