Domanda

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

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top