English 中文(简体)
如何使两个方案的运行自动化?
原标题:how to automate timed running of 2 programs?

我在Linux上工作。我有两个程序,它们无限时间运行(也就是说,除非我杀死进程,否则不会停止)。我想先运行程序1,然后在20秒后运行程序2(两个程序都必须同时运行,因为其中一个读取另一个程序写入的文件)。目前,我通过手动跟踪时间来运行这2个程序。是否有自动化的方法?即是否有任何命令或可以编写任何程序来执行此操作。

最佳回答
prog1 &
sleep 20
prog2
问题回答

使用 Shell:

方案1和计划;睡觉20;方案2

如果一个程序从另一个程序所输出的文件中读取数据,考虑使用管道将输出从一个程序传递给另一个程序的输入。

$> 程序1 | 程序2

我假设您可以控制这两个程序,并让它们写入标准输出并从标准输入读取。





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签