如何并行安排作业并在 linux 和 运行 中传递参数

How to schedule jobs and passing arguments in linux and running in parallel

我想 运行 在特定时间在后台执行脚本。作业接收输入参数。为了安排工作,我发现我应该使用 at 命令并且 运行 像这样:

at -f ./myjob now

而且有效。但是,当我想用​​这样的参数 运行 时:

at -f ./myjob 1 now

它给我乱码时间错误消息。有谁知道如何解决这个问题吗?

更新: 我想 运行 并行使用不同参数的作业。像这样

at -f ./myjob 1 now

at -f ./myjob 2 now

at -f ./myjob 3 now 

at 命令有 -f file 选项,它从文件而不是标准输入中读取命令。因此,将您的命令放在一个文件中,例如 cmds,其中将包含以下内容:

./myjob 1

要运行 多个作业并行使用&符号运算符来分叉每个作业:

./myjob 1 &
./myjob 2 &
./myjob 3

然后运行:

at -f ./cmds now

通过 man at.

阅读 at 手册页可以找到更多信息