简体   繁体   中英

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 would 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM