Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com May 17 '12 at 3:11

This question came from our site for professional and enthusiast programmers.

2 Answers 2

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.

share|improve this answer

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
share|improve this answer
    
Hi yes i tried the mounted stanza also, no effect (added code to the OP) –  gurpal2000 May 16 '12 at 23:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.