Learthgz
Learthgz

Reputation: 133

Run a jar automatically

I am running automatic tests and after each test, all the sessions of these tests are automatically inserted into a temporary table. My tool (in JAR), checks this temporary table and when it finds a new session inserted, my tool scans it and then delete this entry from the temporary table.

Actually I can do that manually without any problem (telling my tool to check the temporary table, if there is something new, scan it…), but I want to do that automatically, I mean my tool always running, and checks automatically (for example every hour) if there is something new in the temporary table.

Could you help me how I can do that ? I guess I need a server where I execute my tool 24/24, which type of server? Thank you very much

Upvotes: 1

Views: 1206

Answers (2)

Varun Selva
Varun Selva

Reputation: 58

Which database you are using. If SQL, you can create the jobs in the database server itself.

Upvotes: 0

Faheem Sohail
Faheem Sohail

Reputation: 846

If you are on a unix based system, you could run the jar as a cronjob. The following would run a jar every 30 seconds.

*/30 * * * * java -jar /path/to/jar/myjar.jar

Read the following to learn how to setup a cronjob correctly https://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job

For windows, use task scheduler. https://stackoverflow.com/a/26932169/802061 as suggested by @kevin-esche in the comments

Upvotes: 2

Related Questions