Shell 在cron选项卡中找不到snowsql

Shell 在cron选项卡中找不到snowsql,shell,cron,snowflake-cloud-data-platform,Shell,Cron,Snowflake Cloud Data Platform,我正试图从一个shell脚本中执行snowsql,这个脚本是我用cron job计划的。但我得到的错误类似于snowsql:command-notfound 我浏览了很多链接,他们要求我们给出雪花的完整路径。我也试过了,但是运气不好。 . 下面是我的代码片段abc.sh: #!/bin/bash set -x snowsql --config /home/basant.jain/snowsql_config.conf \ -D cust_name=mean \ -D feed_nm=lbl \

我正试图从一个shell脚本中执行snowsql,这个脚本是我用cron job计划的。但我得到的错误类似于snowsql:command-notfound

我浏览了很多链接,他们要求我们给出雪花的完整路径。我也试过了,但是运气不好。 . 下面是我的代码片段abc.sh:

#!/bin/bash
set -x
 snowsql --config /home/basant.jain/snowsql_config.conf \
-D cust_name=mean \
-D feed_nm=lbl \
-o exit_on_error=true \
-o timing=false \
-o friendly=false \
-o output_format=csv \
-o header=false  \
-o variable_substitution=True \
-q 'select count(*) from table_name'  
我的crontab如下所示:

*/1****/home/basant.jain/abc.sh
Cron不像您的登录shell那样设置路径

正如您在问题中所写,您可以指定
snowsql
的完整路径,例如

#!/bin/bash
/path/to/snowsql --config /home/basant.jain/snowsql_config.conf \
...
注意:
/path/to/snowsql
只是一个示例。当然,您应该找出
snowsql
的实际路径,例如使用
键入snowsql

#!/bin/bash
. /etc/profile
snowsql --config /home/basant.jain/snowsql_config.conf \
...
或者您可以尝试源代码
/etc/profile
。也许这将设置调用
snowsql
PATH

#!/bin/bash
. /etc/profile
snowsql --config /home/basant.jain/snowsql_config.conf \
...

请参见

Cron不像您的登录shell那样设置
路径

正如您在问题中所写,您可以指定
snowsql
的完整路径,例如

#!/bin/bash
/path/to/snowsql --config /home/basant.jain/snowsql_config.conf \
...
注意:
/path/to/snowsql
只是一个示例。当然,您应该找出
snowsql
的实际路径,例如使用
键入snowsql

#!/bin/bash
. /etc/profile
snowsql --config /home/basant.jain/snowsql_config.conf \
...
或者您可以尝试源代码
/etc/profile
。也许这将设置调用
snowsql
PATH

#!/bin/bash
. /etc/profile
snowsql --config /home/basant.jain/snowsql_config.conf \
...

请参见

我检查过了,但没有helping@BasantJain您“检查”了什么?我正在指定完整路径,如#/bin/bash/path/to/snowsql--config/home/basant.jain/snowsql_config.conf\但是stll它说的是/path/to/snowsql不是found@BasantJain我补充了一项澄清。我不知道
snowsql
的正确路径。我在corntab中添加了下面两行,效果很好。SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin谢谢您的帮助,我检查过了,但是没有helping@BasantJain您“检查”了什么?我正在指定完整路径,如#/bin/bash/path/to/snowsql--config/home/basant.jain/snowsql_config.conf\但是stll它说的是/path/to/snowsql不是found@BasantJain我补充了一项澄清。我不知道
snowsql
的正确路径。我在corntab中添加了下面两行,效果很好。SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin谢谢您的帮助