I’ve got a C# asp.net core app running on an Ubuntu box. I need to run some scheduled tasks and wanted some way to manage that from the app, rather than logging into a terminal.
Is there anyway the C# app can connect to cron and return current jobs, add / edit existing ones?
2
Answers
Best bet is to expand on the following code:
This will get you started with executing bash commands and reading the output in your code.
Alternatively, as Tristan mentioned in the comments, you can certainly read/write the cron files from your code as well.
Not a direct answer but if you want a controllable scheduled tasks you can consider using hosted services to perform background tasks or libraries/frameworks like
Hangfire
or Quartz.NET.