Last post Mar 07, 2019 11:34 PM by InspiredJide
Feb 15, 2019 09:11 AM|InspiredJide|LINK
I am trying to create a cronjob that would enable me populate the database of my website at the first time the web application is set up. This cron job is also suppose to backup data from this web application to another cloud platform.
The web application is running offline at the client premise or office environment. So the web application is suppose to back up data online.
Here is my question.
From my experience with cron job. Cronjobs are more like external scripts that performs background operations. could be in any language. Please is this the same way in asp.net core.
If I am creating a cronjob do all this I have listed above, do I need to create a asp.net core exe that would run this .
Or do I just have a Background Task within my webapplication which would run with a scheduler.
Please if you have sample codes please share I would appreciate.
I just want to be sure that I am doing things the proper way so my application does not fail at the client location. Cos the cron job operations is very very important.
Feb 15, 2019 01:04 PM|mgebhard|LINK
I don't get the approach. A Cron Job is a scheduled task.
I would use migration to populate the database or run a script that run when the app starts.
Feb 15, 2019 02:14 PM|bruce (sqlwork.com)|LINK
Feb 19, 2019 02:15 PM|InspiredJide|LINK
So my app is suppose to download initial data form another server. using migration to see would not work for this particular use case. because the app is a two way system. There is an online version that runs on the cloud. so the local version is suppose
to download initial data from the online version.
Feb 19, 2019 02:16 PM|InspiredJide|LINK
Thanks bruce. You just too brilliant. Please if you have any links on using console app for background cron jobs in asp.net core I would appreciate.
Feb 19, 2019 04:08 PM|bruce (sqlwork.com)|LINK
I'd probably make a shell file to run the asp.net core app, and run the shell job as the cron task, but you can run directly. publish your console app to know path. then in cron the command is
1 0 * * * dotnet <path to publish folder>/<appname>.dll
Mar 06, 2019 07:58 AM|Aylwin|LINK
If you're looking for a simpler cron job solution, you might consider webcron services like easycron.com which will load a specific URL at a given time.
Mar 06, 2019 02:59 PM|bruce (sqlwork.com)|LINK
Mar 07, 2019 11:34 PM|InspiredJide|LINK
Thanks, The webaplication is going to work offline. so the cron job is going to work on a local system. This web application is suppose to back data of the company to our online server. It a sales application to manage sales transaction for a shopping complex.
So my cron job is suppose to work on the local system were the local webserver is domicile.
So it best I understand how to write a professional cron job myself and time it on when it should do a backup. possibly one every day at close of business day.