Linux cronjob not working (execute script)

I created a cronjob with the crontab -e command:

*/1 * * * * /var/lib/tomcat/webapps/ROOT/WEB-INF/scripts/test.sh 

This file test.shshould be executed every minute. But that will not work.

If I run the script manually, it works fine. So I think the problem is cronjob is not a script;)

Are there any permissions or anything else that block cronjob?

Is cronjob syntax correct?

thank

+3
source share
1 answer

For starters, you do not need /1to if you want this to be done every minute. Just set the minute field to *.

script ( #!, ):

env >/tmp/test.sh.dummy
set >>/tmp/test.sh.dummy

, .

, script .

, , cron :

pax> ps -ef | grep cron | grep -v grep
root      1048     1  0 08:45 ?        00:00:00 cron

().

, , , cron , , . , /tmp/test.sh.dummy , , env ; set.

+4

Source: https://habr.com/ru/post/1759650/


All Articles