Hi,
there is a jar file I have to execute everyday at 10:00 AM. I added the below options with crontab -e but it fails to execute. I appreciate if someone could help. Thanks in advance..
0 10 * * * java --add-opens java.base/java.lang=ALL-UNNAMED -jar /home/user/folder/folder/Reminder.jar
0 10 * * * root (cd /home/user/folder/folder/; java --add-opens java.base/java.lang=ALL-UNNAMED -jar Reminder.jar)
Cron job doesn't execute Topic is solved
Re: Cron job doesn't execute
Hi,
did you tried to put your command into a script and have this executed from there?
did you tried to put your command into a script and have this executed from there?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Re: Cron job doesn't execute
Thanks for the reply mate. I didnt try yet. As described here:
https://unix.stackexchange.com/question ... e-in-linux
???
https://unix.stackexchange.com/question ... e-in-linux
???
Re: Cron job doesn't execute
Crontab -e will edit the cron for the user who is running the command, for example dietpi or root.
Better use the full path to the java command, otherwise it might fail for that.
Also the second command is supposed to run as root? Then you need to add it in root's crontab.
Better use the full path to the java command, otherwise it might fail for that.
Also the second command is supposed to run as root? Then you need to add it in root's crontab.
Re: Cron job doesn't execute
One of those two just got executed (don't know which one) at a completely wrong time.. Does cron use a different time then the system time ?Seferi wrote: ↑Thu Oct 08, 2020 1:20 pm Hi,
there is a jar file I have to execute everyday at 10:00 AM. I added the below options with crontab -e but it fails to execute. I appreciate if someone could help. Thanks in advance..
0 10 * * * java --add-opens java.base/java.lang=ALL-UNNAMED -jar /home/user/folder/folder/Reminder.jar
0 10 * * * root (cd /home/user/folder/folder/; java --add-opens java.base/java.lang=ALL-UNNAMED -jar Reminder.jar)
Re: Cron job doesn't execute
Cron job uses the server's define timezone if I'm not mistaken. To find the timezone
readlink -f /etc/localtime
readlink -f /etc/localtime
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Re: Cron job doesn't execute
Strange.. According to output from this: readlink -f /etc/localtime
The time zone is correct...
The time zone is correct...
Re: Cron job doesn't execute
you could check what happen on cron and what time thinks got executed
Code: Select all
journalctl -u cron.service
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Re: Cron job doesn't execute
Very strange.. Journal said it executed in the right time.. But it didn't do anything. I tried rebooting and it suddenly started working. So everytime I add a cronjob it doesn't take effect until I reboot but strangely before reboot, journal says the code was executed...Joulinar wrote: ↑Thu Oct 08, 2020 7:19 pm you could check what happen on cron and what time thinks got executed
Code: Select all
journalctl -u cron.service
Re: Cron job doesn't execute
Probably it's enough to restart cron.service to get it activated. But strange that this would be needed. 

Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team