开发者

Run a program as a Service?

开发者 https://www.devze.com 2022-12-13 05:47 出处:网络
I have a c# console program that backs up a SQL database on a Windows server. I want it to run every day.I have two issues:

I have a c# console program that backs up a SQL database on a Windows server. I want it to run every day. I have two issues:

1- How best to run and s开发者_如何学JAVAetup this program on the server? Do I put it on task scheduler or put a timer within the program itself?

2- How can I then set up a local program to periodically retrieve the backup from the remote server?


Using Task Scheduler is a much better idea than using a timer - you should be able to leverage your existing program to get this done


I would use task scheduler instead of a windows service (I've had a similar situation and we decided to do the task scheduler and it was much simpler). I'm not sure what you need to retrieve, but you could make that a scheduled task too and have it access a shared location on the server. If it is a simple task to retrieve the backup, you could just use a batch file or powershell script. Otherwise, you can write an app for that.


I know that is windows server in discussion. Yet, if you want to follow the Unix philosophy you may consider using at as your scheduler for both tasks (1 and 2). That is: Make each program do one thing well.

0

精彩评论

暂无评论...
验证码 换一张
取 消