简体   繁体   English

cron 作业无法运行

[英]cron job failed to run

Retrieval of graphics card sales information显卡销售信息的检索

#!/bin/bash
curl=$(which curl)
RTX3060="http://0.0.0.0:5000/rtx3060"
RTX3070="http://0.0.0.0:5000/rtx3070"
RTX3080="http://0.0.0.0:5000/rtx3080"
RTX3090="http://0.0.0.0:5000/rtx3090"
RX6700="http://0.0.0.0:5000/rx6700"
function output_(){
 $curl $RTX3060 $RTX3070 $RTX3080 $RTX3090 $RX6700 > sales.txt
}
output_

and my cron job that should run every minute from november to december我的 cron 工作应该从 11 月到 12 月每分钟运行一次

#!/bin/bash
*/1 * * nov-dec *  /user/bin/bash /sells_Cards/sold.sh

I can't understand why the job it's not running by itself, I have to type the./sold.sh in order to run the script.我不明白为什么它不能自己运行作业,我必须键入 ./sold.sh 才能运行脚本。

The idea is that I have to create a script that takes as entry an API (the sales per minute of the largest graphics card vendors) and as an output the number of grapihic cards sold on each minutes( rtx3060, rtx3070, rtx3080, rtx3090 et rx6700) the results should be stored in a sales.txt file.我的想法是,我必须创建一个脚本,将 API(最大显卡供应商的每分钟销售额)作为输入,并将每分钟售出的显卡数量作为 output(rtx3060、rtx3070、rtx3080、rtx3090 等) rx6700) 结果应存储在 sales.txt 文件中。 I have created a directory under home named sells_Cards (/home/ubuntu/sells_Cards) and under this directory the sales.txt and the script sold.sh.我在主目录下创建了一个名为 sells_Cards (/home/ubuntu/sells_Cards) 的目录,并在该目录下创建了 sales.txt 和脚本 sold.sh。 I used crontab -e to create the job as mentioned above.如上所述,我使用 crontab -e 来创建作业。

Please help me to find the pb(by the way I dont know a lot(only few) of bash scripting)Thanks in advance请帮我找到 pb(顺便说一下,我不太了解 bash 脚本)提前致谢

curl accepts only 1 url in the command line curl在命令行中只接受 1 url

Usage: curl [options...] <url>

so you need something like this (an array would be much better though)所以你需要这样的东西(不过数组会好得多)

output_() {
 {
     $curl $RTX3060
     $curl $RTX3070
     $curl $RTX3080
     $curl $RTX3090
     $curl $RX6700
 } > sales.txt
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM