0

I have found many ways of starting a script or program when booting Linux, but none of the options is sufficient for what I am looking for:

  • I have a Raspberry Pi running raspbian wheezy
  • I have a compiled c-program which creates echo-outputs from time to time
  • I would like the program to run on startup of the pi and be able to connect via ssh and see what is going on in the program (get echo-live-output, not only a log-file).

Is there any way of achieving this?

4

2 回答 2

0

要在启动时运行程序,请将其放在根目录中crontab并使用该@reboot选项。为什么不想将输出重定向到日志文件?然后您可以通过多种方式监控它的输出(例如,使用 scp)。

于 2013-08-14T11:29:47.020 回答
0

对于遇到类似问题的任何人:我通过以下方式解决了它:

我创建了一个启动bash脚本,包括

sudo /foo/main.o | tee /foo/log;

它将输出写入日志文件。由于输出是在无限循环中创建的,因此必须确保fflush(stdout);在每个printf()

然后我可以使用监视日志文件

tail -f /foo/log
于 2013-09-03T14:00:53.813 回答