0

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!

ElkeAusBerlin
  • 565
  • 1
  • 4
  • 18

2 Answers2

2

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
CameronNemo
  • 616
  • 3
  • 10
0

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.

Sridhar Sarnobat
  • 25,183
  • 12
  • 93
  • 106