[英]How to launch sh script with crontab?
I have sh script that works perfectly if you launch it by yourself.如果您自己启动它,我的 sh 脚本可以完美运行。 But when I try to put it to the crontab nothing happens.但是当我尝试将它放到 crontab 中时,什么也没有发生。 My cron schedule expressions is我的 cron 计划表达式是
21 20 * * * bash a.sh
And this sh script includes这个 sh 脚本包括
cd /home/ubuntu/currencies_datas_get && python3 AAVEUSDT.py &
cd /home/ubuntu/currencies_datas_get && python3 ADAUSDT.py &
cd /home/ubuntu/currencies_datas_get && python3 APEUSDT.py &
cd /home/ubuntu/currencies_datas_get && python3 ATOMUSDT.py &
It suppose to launch these scripts along and it really works if you try to type bash a.sh
to the ubuntu console它应该同时启动这些脚本,如果您尝试将 bash a.sh 键入bash a.sh
控制台,它确实有效
Assuming a.sh is in $HOME, make your crontab假设 a.sh 在 $HOME 中,让你的 crontab
21 20 * * * bash $HOME/a.sh
Additionally, depending on where your python3
binary is located, you may need to specify its full path, ie, /usr/bin/python3
in your script.此外,根据您的python3
二进制文件所在的位置,您可能需要在脚本中指定其完整路径,即/usr/bin/python3
。
I suggest to add full path to python3
in your script.我建议在脚本中添加python3
的完整路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.