简体   繁体   English

新贵:在脚本中回显

[英]upstart: echo in script

in my upstart script (Ubuntu 12.04.2) I have the following: 在我的暴发户脚本(Ubuntu 12.04.2)中,我具有以下内容:

exec touch /tmp/000
exec echo "ds1307 0x68" >  /sys/class/i2c-dev/i2c-3/device/new_device
exec touch /tmp/111
exec hwclock --rtc=/dev/rtc1 --hctosys  
exec touch /tmp/222

The problem is that /tmp/000 is there but none of the other files in /tmp. 问题是/ tmp / 000存在,但/ tmp中没有其他文件。 So it seems after the echo the script stops. 因此,似乎在回声之后脚本停止了。

How to rewrite the line with the echo so the script does not stop? 如何用回声重写行,以使脚本不会停止?

Thanks! 谢谢!

Replace all the exec's with the following: 用以下命令替换所有执行程序:

script
  touch /tmp/000
  echo "ds1307 0x68" >  /sys/class/i2c-dev/i2c-3/device/new_device
  touch /tmp/111
  hwclock --rtc=/dev/rtc1 --hctosys  
  touch /tmp/222
end script

The command exec replaces the current process with, in your case, the touch command in line 1. Afterwards there is no shell any more to return. 在您的情况下,exec命令用第1行中的touch命令替换当前进程。此后,不再有任何shell可返回。

Answer: explaining the exec command. 答:解释exec命令。

Try your script without the exec's. 在没有执行程序的情况下尝试脚本。

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

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