2

Hi can i use the old style init scripts under ub 12.04? im fed up with my upstart scripts working intermittently.

I have a process which relies on cifs mounts (defined in fstab). I've tried all the usual 'wait for the interface' and 'wait for the local filesystem' dependencies in my upstart but nothing seems to work. My command works fine on the cmd line.

I think what's happening is that cifs hasn't mounted at the time the upstart script tries to run. Upstart just seems broken to me.


start on (local-filesystems and net-device-up IFACE=eth0 and mounted MOUNTPOINT=/storage/server)
stop on shutdown

expect daemon

script
cd /storage/server/scripts/myprog
su -c "/home/gurpal2000/ruby-1.9.3-p0/bin/bundle exec /home/gurpal2000/ruby-1.9.3-p0/bin/ruby lib/main.rb > /storage/server/logs/myprog.txt 2>&1" gurpal2000
end script

Thanks

2 Answers 2

1

Upstart is not broken. Take a look at the following:

I think you may be able to simplify your 'start on' to be simply:

start on (filesystem and static-network-up)

Take a look at upstart-events(7), or online here:

http://upstart.ubuntu.com/cookbook/#ubuntu-well-known-events-ubuntu-specific

See also:

Upstart still supports SysV jobs, so if you really want to you can create /etc/init.d/foo.

0

I haven't tried replacing Upstart with good old SysV-init, but it should be doable; at least, swapping among init-replacements in the past was pretty straightforward. You just need to be sure that you're replacing at a minimum the following programs:

/sbin/halt
/sbin/init
/sbin/initctl
/sbin/poweroff
/sbin/reboot
/sbin/shutdown
/sbin/telinit

The package manager will try to restart init when a new C library is installed; hopefully this is managed through the standard telinit interface rather than hard-coded to Upstart mechanisms specifically.

And I certainly wouldn't expect event-managed scripts to run -- plugging in USB sticks might require you to mount them yourself. (Which, in my opinion, is the better approach anyhow.)

Before giving up on your Upstart configuration file though, have you tried:

start on mounted MOUNTPOINT=/path/to/mountpoint
1
  • Hi yes i tried the mounted stanza also, no effect (added code to the OP)
    – gurpal2000
    May 16, 2012 at 23:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .