N
N
nurzhannogerbek2018-12-26 13:19:50
Task Schedulers
nurzhannogerbek, 2018-12-26 13:19:50

How to check if the CRON scheduler is working?

Hello comrades! Please help me figure it out. Faced with strangeness and I can not understand at what stage the error occurred.
In the directory I have 2 files:

- application.jar
- application.sh

The application.sh file launches the application.jar file. The latter in turn deletes records from the database. The application.sh
file was run every hour using the CRON scheduler. After I changed the application.jar file in the database, the data was no longer deleted. I thought that the scheduler had disappeared, but the command gives the following: That is, there is a task in the scheduler. Next, I thought that the .jar file was not correct, but when I manually ran the .sh file, the data from the database disappeared from the same moment. That is, the .jar file worked correctly. What is going on in your opinion? Where to look for a problem? crontab -l
* */1 * * * /path/application.sh

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
nurzhannogerbek, 2018-12-27
@nurzhannogerbek

Solved the problem. The problem was with the rights. In the .sh file itself, the path to the .jar file was specified correctly. Added logging now, it became easier:
By the way, I found the cron file in the /var/log/ directory . It contains information about the launches of the scheduler.

G
GavriKos, 2018-12-26
@GavriKos

The problem must be looked for in the logs.
Log as much as possible in the jar, from launch to output.

A
Alexander Chernykh, 2018-12-26
@sashkets

if everything is OK with the rights, then I suspect that in application.sh you need to specify
# path to application .jar
cd /path/
and further in the text

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question