문제

I have a shell script that I have scheduled using cron using a command:

0 10 * * * /directory/Script.sh > /directory/log/output.log

The script is scheduled to run at 10 AM everyday. The script executes but produces output files only with headers, no content is there.

The script produces two output files. When I run the script manually it works fine. But when scheduled it is not producing the correct output.

Help me out.

Thanks

도움이 되었습니까?

해결책

Multiple reasons

1> Check full path of all executable in the script.

2> Ensure all environment variables are set accordingly

3> Check the script when run from the same user as the cron is executing.

Technically there is no difference between manually running a script and scheduling from cron

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top