Programmatically created scheduled tasks

I’m using CommandBox and CFConfig as my local dev environment for an app that creates scheduled tasks programmatically. It’s awesome, that you!

That said, I have two questions/possible problems:

  • Far as I can tell from the docs on Config Items, CFConfig doesn’t manage Tasks. Am I right about that? If that’s the case, I can manually tell the app I’m working on to recreate them. Is that the right plan, given the current state of CFConfig? Are there any plans to add services like tasks as config items?

  • That’s made a little less warm-and-fuzzy by the fact that those programmatically created tasks don’t show in Lucee Admin, at either the server or web levels, immeidately after creating them. Does it have anything to do with CFConfig? Is there anything you know of that I can do to fix it?

Thanks in advance for any ideas.

Scheduled tasks are supported by CFConfig on Adobe servers because a client paid me to add them,. Are you offering to pay for Lucee support to be added? :slight_smile: I’ll likely get around to adding it at some point otherwise but it’s a low priority for me personally since I don’t use scheduled tasks. You can also take a stab at adding support via a pull request if you like. I’ve had probaby 3 or 4 people tell me they were going to do this but no pulls have come through yet for Lucee task support… BTW, that reminds me I need to update the docs to reflect some of the recent additions.

those programmatically created tasks don’t show in Lucee Admin, at either the server or web levels, immediately after creating them

Sorry, not following you. How are you creating them? Via CFConfig (which obviously won’t work) or via the admin UI, or via some CFML code? And were are you trying to see them?

Does it have anything to do with CFConfig?

CFConfig certainly doesn’t do anything to inhibit tasks from working as normal if that’s what you’re asking.

Is there anything you know of that I can do to fix it?

At this point I don’t understand what you’re asking :slight_smile:

Thanks for your reply Brad. I get it about task support for Lucee, doubt my company would go for sponsoring that. I’m using CFConfig, but it’s not company infrastructure. Yet, maybe.

Re visibility in lucee admin, they’re getting created by cfml code, that’s what I meant by “programmatically created”. They appear to be running, but I can’t see them in lucee admin, in either scope.

I doubt that has anything to do with CFConfig, but since it’s happening I thought I’d ask. If not, it must be a CommandBox thing, I guess, but it is odd. Any ideas would be appreciated.

Thanks again,
Dave

Sounds like a Lucee bug to me. I’ve never really created tasks programmatically so I’m not sure how to even test that. If you remove CFConfig entirely from he equation, does it still happen? (Just making sure nothing is getting overwritten). If you can produce it, I’d ask on the Lucee Discourse forum. Also, perhaps you can track down the XML file being used to store the tasks. I know “normal” scheduled tasks are in a scheduler.xml file and they are specific to a web context (never server). I’m not sure if the kinds of tasks you’re creating would also be in the same file or not.

Someone has sponsored scheduled task support for CFConfig if you want to give it a test.

Just shooting from the hip:
Sounds like a “Context” issue.

You might find the schedule tasks are being created just fine but are not displaying in the Lucee Admin because the schedule.XML has not been copied into the admin context for you to see them?

We have to do this (your paths might need a tweak)
cp /opt/lucee/config/web/centra/scheduler/scheduler.xml /opt/lucee/config/web/luceeAdmin/scheduler/

Gavin

I was looking at the commandbox scheduled task page. Will BOX need to be restarted for the scheduled tasks to take effect?

FWIW, I typically will create a scheduled task page on the websites, typically in the admin area, that will turn scheduled tasks on and off via cfschedule.

I think there’s some confusion here. What exactly are you using CFConfig for? Are you creating scheduled tasks in a running server? If so, yes a restart would be required. CFConfig only modifies XML files on disk, it doesn’t affect running servers’ memory.

This makes me wonder if you’re trying to create scheduled tasks in a SERVER or in the Lucee engine that powers the CLI. Restating the box CLI is not the same as restarting a server process.

I’m not quite sure what that has to do with CFConfig, but creating a scheduled task via CFConfig is no different than creating it in the Lucee or Adobe admin with the notable exception that the changes will not take affect right away.

You CAN have both Lucee and Adobe watch config files for changes BTW if you want.