我有以下的任务列表要完成,他们正在顺利地工作。
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文件本身启动并完美地完成了它的工作,但是crown
出现了一些问题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
分析器—向电报发送消息的文件,这里是检查
的设置*/5 * * * * bash /home/user/Code/start_analyzator.sh >> ~/cron.log 2>&1
可能是什么问题,一些文件工作良好和其他不??
您的shell脚本中出现了DOS行结束符,CR被解释为文件名的一部分,而文件名实际上并不存在。
处理这个问题的一个方法是使用linux编辑器;另一种方法是使用
dos2unix < infile > outfile