在Ubuntu上运行Cron作业

时间:2020-06-15 20:31:21

标签: linux ubuntu cron

我有一个python脚本,该脚本生成一个csv文件,然后使用nodejs脚本将csv文件转换为xmls文件,最后使用其他nodejs脚本将该xmls文件导入到Google电子表格中。

我希望能够执行一项cron作业,该作业每天自动执行一次。

这是我必须手动使用的命令列表:

ValueError: invalid literal for int() with base 10: '10 90'
Command exited with non-zero status 1 

1 个答案:

答案 0 :(得分:2)

使用&&,您可以创建一个单行cron命令,该命令将按顺序执行命令(假设所有出口均无错误)。 例如,如果您想每天凌晨3点运行连续命令,则可以将其添加到crontab中: 0 3 * * * python3 /full/path/to/first/script/otomoto.py && node /full/path/to/second/script/csvtoxmls.js && node /full/path/main.js

额外的cron配置,您可以检查:https://crontab.guru/