开发者

How to run program that sends bills to customers once a month?

I have a table in database with users and their expenses for traveling. I am using GWT and want to run a code once a month, that woul开发者_如何学编程d query the database and send bills as PDFs to customers. I know how to create PDFs and send emails from servlet. How to run a program in java (or some other script if it isn't possible with java) that would run once a month?

Tnx


Unix and derivatives: use cron -> http://en.wikipedia.org/wiki/Cron

Windows: use task scheduler -> http://support.microsoft.com/kb/308569

If you want to get fancy and do it purely in java: -> http://www.quartz-scheduler.org/, but do consider OS scheduler first.


you have many choices.

If you are under Unix, the simpliest solution is a batch scheduled with a crontab.

If you prefer a 100% java solution, the Quartz framework is a robust a easy to setup solution.


To avoid "re-inventing the wheel" I suggest using http://www.freshbooks.com/ and tying your app into their API to send your bills. You can easily set up recurrence as a billing option so that the bills get re-sent (along with reminders) each month. The user can then grab the PDF version of their bill.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜