azcopy command inside python script is not working when running from crontab

Jatinmaya Choudhury 1 Reputation point
2021-02-04T19:43:39.13+00:00

Hi Team ,
We have a python script which invokes an azcopy command like below

os.system("azcopy copy {} 'https://8f****stg.blob.core.windows.net/dremioprodfs/tables/md/reflection_hist/<SAS Token here>' --recursive=true".format(dest_file))

It works perfectly fine when we directly trigger the python script ,but when we schedule through the crontab it does not work

in the log file we see that
sh: azcopy: command not found

Please provide a solution on this

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
40,140 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sumarigo-MSFT 47,196 Reputation points Microsoft Employee
    2021-02-08T07:35:28.387+00:00

    @Jatinmaya Choudhury Thanks for raising this question! Firstly, apologies for the delay in responding here and any inconvenience this issue may have caused.

    Based on the error message can you, please Try running it by calling it

    ./azcopy

    Can you try to re-generate the New SAS token and try again.
    Instead of just azcopy. And make sure your working directory, at the time, is the place where the azcopy executable is. If that doesn't work, please let us know The OS can only find azcopy if it was part of the path. Invoking it with a relative path ./azcopy or absolute path /usr/name/bla/azcopy would be the alternatively way.

    If the issue still persists, Can you please share the screenshot of the error message and also the complete code (Hiding the PI data)

    Hope this helps!

    Kindly let us know if the above helps or you need further assistance on this issue.

    ----------------------------------------------------------------------------------------------------

    Please don’t forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.