# Scheduler commands through node.js

**URL:** <https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572>\
**Category:** Get Help\
**Tags:** question\
**Created:** [June 17, 2024, 2:33pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572 "2024-06-17T14:33:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![GKlouse](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/gklouse/32/1046_2.png) [@GKlouse](https://discourse.openondemand.org/u/GKlouse)\
**Post date:** [June 17, 2024, 2:33pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572/1 "2024-06-17T14:33:17Z")

</div>

This is kind of a noob question, but I’d like to know how I could write in scheduler calls into html widgets using node.js, similarly to how the active jobs app works. I have looked through the code repo, but cannot figure it out.

I’d like to start with a simple ‘scancel jobid’ call from a button.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/b77e7a25a34263ff17cb92fb44ba18baf21a04e5.png)

Any guidance on how to get started with this?

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [June 21, 2024, 2:21pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572/2 "2024-06-21T14:21:09Z")

</div>

Hi! Sorry for the delay. I assume this is a passenger app in which you wrote the backend server for.

If that’s the case, what you want to do is turn that `button` into a `form` that can `POST` requests back to the backend server. The backend server, having received a POST request to say something like `/myapp/scancel` can then issue CLI commands.

Not sure if that answers your question, but feel free to post again and I’ll respond.

---

<div class="post-metadata">

**Author:** ![GKlouse](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/gklouse/32/1046_2.png) [@GKlouse](https://discourse.openondemand.org/u/GKlouse)\
**Post date:** [September 5, 2024, 5:32pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572/3 "2024-09-05T17:32:15Z")

</div>

Thanks Jeff,  
I let this slip away from me, but I am revisiting it now.

I really just need to understand how to execute CLI commands through node.js in the open ondemand framework. This example is the easiest I have, where I would like to script a button which calls a scheduler command for a given task, essentially re-creating the function that exists in the activejobs app that is part of your release package.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/e/ec4524c59e10f7ef3d6fee38e3d3a430274f88c5.png)

Once I can wrap my brain around that I want to build similar functionality into dashboard widgets for accounting and usage tracking for our customers.

---

<div class="post-metadata">

**Author:** ![GKlouse](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/gklouse/32/1046_2.png) [@GKlouse](https://discourse.openondemand.org/u/GKlouse)\
**Post date:** [September 10, 2024, 1:24pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572/4 "2024-09-10T13:24:21Z")

</div>

@jeff.ohrstrom after researching this, It seems I need a better understanding of full stack. I was really looking for the path of least resistance to build something around what has been done in OOD so that I wouldn’t have to build an entire packaged app.

If there is a simple way to invoke node.js or server side commands through the front end that requires minimal dev please let me know, however it seems to me that I will need to build an app and deploy it on OOD.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [September 10, 2024, 1:56pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572/5 "2024-09-10T13:56:03Z")

</div>

OK yea if you want to add some functionality to OnDemand itself, then you’d have to hack around on it and deploy extra files on top of ours (while also applying patches to existing files). There’s no out of the box way to just add functionality like this.

Yea it does sound like you need a whole new web stack to deploy as an OnDemand app.

---

<div class="post-metadata">

**Author:** ![alanc](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/alanc/32/2524_2.png) [@alanc](https://discourse.openondemand.org/u/alanc)\
**Post date:** [September 10, 2024, 7:21pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572/6 "2024-09-10T19:21:47Z")

</div>

Several years ago, @shawn.doughty from Tufts gave a demo during one of our OOD webinars showing a rather simple way to add menu items to OOD that execute shell commands and show the output (things like the ‘groups’ command to see a list of the groups a user belongs too). Seems to me this might be an approach you could take here. I don’t recall the specific details, but hopefully Shawn will chime in and let us know.

---

<div class="post-metadata">

**Author:** ![alanc](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/alanc/32/2524_2.png) [@alanc](https://discourse.openondemand.org/u/alanc)\
**Post date:** [September 10, 2024, 8:35pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572/7 "2024-09-10T20:35:43Z")

</div>

I realized I have the slides from that demo, so here are some screenshots:

 ![Screenshot 2024-09-10 163444](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/1/1fac00e4f57f67fa47c6fbfd7f2092dfd808025a.png)  
 ![Screenshot 2024-09-10 163503](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/a/ad18523165085293f51c05ff360815368e774da6.jpeg)

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [September 10, 2024, 8:43pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572/8 "2024-09-10T20:43:34Z")

</div>

That’s a separate web application than OnDemand, not a modified OnDemand.

If I get time sometime, I can hack together a node.js example of issuing a command through an HTTP request.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [September 11, 2024, 2:45pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572/9 "2024-09-11T14:45:00Z")

</div>

I’ve hacked together this application this morning to demonstrate how to do this in Node JS.

> **[GitHub - johrstrom/simple-nodejs-button](https://github.com/johrstrom/simple-nodejs-button)**
>
> Contribute to johrstrom/simple-nodejs-button development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [March 10, 2025, 2:45pm UTC](https://discourse.openondemand.org/t/scheduler-commands-through-node-js/3572/10 "2025-03-10T14:45:48Z")

</div>

Closed on March 10, 2025, 2:45pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
