Crontab python脚本未运行(linux服务器上的anaconda)

Crontab python脚本未运行(linux服务器上的anaconda),python,linux,bash,cron,Python,Linux,Bash,Cron,我有以下任务要完成,它们正在成功地工作 0 0 */1 * * bash /home/user/Code/agapov/start_GHR_Y00011285.sh >> ~/cron.log 2>&1 5 0 */1 * * bash /home/user/Code/agapov/start_GHR_Y00011280.sh >> ~/cron.log 2>&1 10 0 */1 * * bash /home/user/Code/aga

我有以下任务要完成,它们正在成功地工作

0 0 */1 * *  bash /home/user/Code/agapov/start_GHR_Y00011285.sh >> ~/cron.log 2>&1
5 0 */1 * *  bash /home/user/Code/agapov/start_GHR_Y00011280.sh >> ~/cron.log 2>&1
10 0 */1 * *  bash /home/user/Code/agapov/start_GHR_Y10001320.sh >> ~/cron.log 2>&1
20 0 */1 * *  bash /home/user/Code/agapov/aggregation.sh >> ~/cron.log 2>&1
25 0 */1 * *  bash /home/user/Code/ivanov/start_API_N00001010.sh >> ~/cron.log 2>&1
文件结构如下:

 #!/bin/bash
 source /home/user/anaconda3/bin/activate
 python /home/user/Code/agapov/GHR_Y00011280.py 
 conda deactivate
但随后出现了一个问题,我添加了几个新文件来执行,但它们不起作用。下面是这样一个文件的代码示例

 #!/bin/bash
 source /home/user/anaconda3/bin/activate
 python /home/user/Code/analyzator.py 
 conda deactivate
正如您所看到的,它是完全相似的,python文件本身启动并完美地完成了它的工作,但是crowns出现了一些问题

Cron日志:

/home/user/Code/start_analyzator.sh: line 4: conda: command not found
/home/user/Code/start_analyzator.sh: line 2: /home/user/anaconda3/bin/activate
: No such file or directory
/home/user/Code/start_analyzator.sh: line 3: python: command not found
bash: /home/user/Code/ivanov/start_DS_N00001400.sh: No such file or directory
/home/user/Code/start_analyzator.sh: line 4: conda: command not found
/home/user/Code/start_analyzator.sh: line 2: /home/user/anaconda3/bin/activate
: No such file or directory
/home/user/Code/start_analyzator.sh: line 3: python: command not found
/home/user/Code/start_analyzator.sh: line 4: conda: command not found
analyzator-向电报发送消息的文件,以下是用于检查的设置

*/5 * * * * bash /home/user/Code/start_analyzator.sh >> ~/cron.log 2>&1

可能是什么问题,有些文件工作正常,而有些文件工作不正常???

如果shell脚本中存在DOS行结尾,CR会被解释为文件名的一部分,而文件名实际上并不存在

处理这个问题的一种方法是使用linux编辑器;另一种方法是使用

dos2unix < infile > outfile
dos2unixoutfile

看起来您需要在cron作业中设置PATH变量。您是否在windows计算机上创建了shell脚本?@RamanSailopal所有内容都已配置,以前没有此类问题,旧设置成功运行。看来不是这样case@tink是的,我通过Moba工作,一台运行Windows 10的计算机将文件转换为unix行结尾。。。