I need to run a sh script send.shas shown below:
node send.js -q 8435924032 >> send.log
If I run it with crontab, */2 * * * * /home/app/send.sh
nothing is output.
And there is mail that shows an error caused by the cron process:
ReferenceError: Promise is not defined
at requestURL (/home/app/getData.js:34:16)
at Object.getData (/home/app/getData.js:15:18)
at /home/app/send.js:173:41
...
However, it gives me the correct output and NO ERROR when I directly run sh send.sh
Can someone help? I want to run the program every two minutes. I tried PM2, but such a cron function does not work.
source
share