P
P
podguzovvasily2021-01-11 11:57:31
Task Schedulers
podguzovvasily, 2021-01-11 11:57:31

How to execute groovy script through scheduler?

Hello! How to schedule Groovy script execution via CRON?

Create line:
25 08 * * * root /bin/sh -c cd /home/scripts/ && groovy test.groovy
Gives an error:
/bin/sh: 1: groovy: not found
Although if you run the crypt itself in the console: groovy test .groovy works.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Karasik, 2021-01-11
@podguzovvasily

standard answer: because CRON has a different environment.
from your user run
which groovy
get something like /usr/local/bin/groovy
and put that in place of groovy in cron.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question