I'm trying to call node file.js
with Bluemix Workload Scheduler every morning; file.js is in the root of my node.js project; file.js is not my server file. I used to use cron but it seems like "BlueMix doesn't have a concept of cron jobs."
As result for the (only) step of my process, I got "node : command not found"
I think I missed something. Is it even possible to do this with Workload Scheduler or should I find alternative options?
MORE INFORMATION
I'm trying to do :
var wls = new WorkloadService(credentials);
var wp = new WAProcess("MyProcessName", "DescriptionProcess");
wp.addStep(new CommandStep("node file.js", myAgentName));
wp.addTrigger( TriggerFactory.repeatDaily(1) );
wls.createAndEnableTask(wp, function(res){
wls.runTask(res.id, function(){console.log("Process is created and started.")});
});
I can see in "IBM Workload Automation on Cloud - Application Lab" that the process is created and started. A few later, process has failed saying "node command not found"
I think i read in the documentation that the agent can only call local system commands (such as cat, pwd ... ) or commands that interact with outside (for REST services call). So there's no way it can find node command or file.js.
Unless I install everything on the agent ? Documentation says we can install programs in /home/wauser/workspace
directory by using curl command. Is that how I should proceed ?
You should modify your NodeJS application to let it expose a method that can be run using the curl command and provides the proper output and logging. The curl calling the method will then be run in the Workload Scheduler job. Workload Scheduler service is not part of the node runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With