Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crontab not able to Run jar file

Tags:

java

jar

crontab

By running:

00 01 * * 1 root /usr/bin/java -jar /home/export/export.jar

Output: the scheduler will fail to wake up.

Then I changed it to:

00 01 * * 1 root /usr/bin/java -jar /home/export/export.jar > /home/export/cron.log 2>&1

It worked!

Can I do this without exporting to the file - cron.log?
I did used log4j to log the process; cron.log is a duplicate log for me.

like image 238
HenryLoke Avatar asked Nov 12 '22 20:11

HenryLoke


1 Answers

You can replace with /dev/null , as in:

00 01 * * 1 root /usr/bin/java -jar /home/export/export.jar > /dev/null 2>&1
like image 52
Patrice M. Avatar answered Nov 15 '22 04:11

Patrice M.