Tuesday, 21 March 2017

Cron job to run a jar file


If the requirement is to run the jar file on daily basis, we need to create a cron job.
To create a cron job, follow below steps:


  • Open terminal.
  • Type crontab -e ,It will open an editor to edit cron job.
  • If you want to run your jar on daily basis , put 0 0 * * * java -jar Sample.jar
  • For ex: 0 0 * * * java -Dlog4j.debug -DlogDir=./ -jar /opt/appl/giftcard/valuelinkSimulator/valuelink-simulator.jar.
  • Save the cron job.
We can also view the job using crontab -l command.

Enjoy Learning.

No comments:

Post a Comment