Dump database from crontab not working on Ubuntu

Hi ,
i am trying to run cockroach dump script from crontab with following script, file is created with no data.

script file

current_time=$(date “+%Y.%m.%d-%H.%M.%S”)
cockroach dump mydatabase --insecure --dump-mode=data > cockroachdb"$current_time".sql

any idea what is wrong ?
and when i run same script file from terminal like ./dbscript.sh its working fine, both file with current date is created with backup data statements.

normally that is because the cron environment is pretty much empty. Make sure you have a valid PATH that has your cockroach executable is in a directory that is in PATH, or add that directory to your PATH within your script.

Thanks for your quick response.
i have tried following in crontab

59 09 * * * /home/user/dbbackupscript.sh

59 09 * * * cd /home/user && ./dbbackupscript.sh

I assume both did not work. In that case add in your script:
export PATH=$PATH:$HOME/where/your/cockroach/ is.

You can also make this a bit easier to debug by redirecting the output to a logfile like:
59 09 * * * $HOME/dbbackupscript.sh >$HOME/dbbackupscript.log 2>&1

Should we need to add path in dump script file like below

"

export PATH=$PATH:$usr/local/bin/cockroach

current_time=$(date “+%Y.%m.%d-%H.%M.%S”)
cockroach dump mydbname --insecure --dump-mode=data > cockroach_db_"$current_time".sql

"

if /usr/local/bin/cockroach is your executable, you should add
export PATH=$PATH:/usr/local/bin/

Thanks . its working now