C
C
ceregapro12020-07-07 21:40:07
bash
ceregapro1, 2020-07-07 21:40:07

Why doesn't .sh run on cron?

Cronetab:
* * * * * /root/script.sh

script.sh:
pm2 delete all

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
ceregapro1, 2020-07-07
@ceregapro1

Solved the error:
* * * * * /usr/local/bin/pm2 delete all

S
Sergey Pankov, 2020-07-07
@trapwalker

In the crontab, you must specify the absolute paths and programs that need to open files.

* * * * * /bin/sh /root/script.sh >> /tmp/script.log

I added to the example how to make the script output be added to the file and you could understand what went wrong there and how it works.

V
Valdemar Smorman, 2020-07-07
@smorman

Where is
#!/bin/bash on
the first line?
And the script still needs to be made executable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question