forked from Paperspace/paperspace-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts_create.js
More file actions
27 lines (24 loc) · 879 Bytes
/
scripts_create.js
File metadata and controls
27 lines (24 loc) · 879 Bytes
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
// Assumes you have installed the paperspace-node package globally.
// Use "require('../../paperspace-node')" if running from the repository tree.
var paperspace_node = require('paperspace-node');
// Set apkKey for use of the paperspace api
var paperspace = paperspace_node({
apiKey: '1be4f97...' // Substitue your actual apiKey here
});
// Retrieve a list of all the templates as a json array
console.log('\npaperspace.scripts.create(...);');
paperspace.scripts.create({
scriptName: 'Test Script',
scriptDescription: 'scripts_create.js',
machineId: 'ps123abc',
//scriptFile: './my_script_file.sh', // either scriptFile or scriptText is required
scriptText: 'services start nginx16',
isEnabled: true,
runOnce: false
}, function(err, resp) {
if (err) {
console.log(err);
process.exit(1);
}
console.log(resp.body);
});