I have a .jar which I can run perfectly via the command line.
I need this to be running continuosly every 5 mins, so i did crontab -e where I added this line
*/5 * * * * java -jar /var/www/java/executable.jar
if I go
grep CRON /var/log/syslog
I do see where the job was executed, but it never was since I have a logger inside the java file and the first thing it does is append to the logger the time, which is not doing so.
What can be the possible error?
解决方案
The most common error is that the environment-variables not bound and
java is not in path
JAVA_HOME is not set.
Try
*/5 * * * * java -jar /var/www/java/executable.jar > /var/log/javacron.log 2> /var/log/javacron-err.log
and inspect the /var/log/javacron.log-file for more informations.