ElkeAusBerlin
ElkeAusBerlin

Reputation: 575

upstart: echo in script

in my upstart script (Ubuntu 12.04.2) I have the following:

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. So it seems after the echo the script stops.

How to rewrite the line with the echo so the script does not stop?

Thanks!

Upvotes: 0

Views: 909

Answers (2)

Stefan Friedrich
Stefan Friedrich

Reputation: 188

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.

Answer: explaining the exec command.

Try your script without the exec's.

Upvotes: 0

CameronNemo
CameronNemo

Reputation: 616

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

Upvotes: 2

Related Questions