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.

I am trying to get an upstart job to start after both 2 other jobs have completed. As an example, I have debug.conf that looks like:

start on stopped networking and stopped screen-cleanup
task
script
    date
end script

I have added a date call at the end of screen-cleanup.conf's script, and at the beginning of networking's post-stopped script as well. The time stamps should allow me to see roughly what order things were run in.

I have rebooted several times now and the behaviour seems to be variable. Initially I found that the above "debug" job would run after "networking" but before "screen-cleanup" had finished (based on the date outputs). Since then I have tried various tests and found that similar conditions, but dependent on signals I was sending via initctl emit (to save me from having to reboot) rather than "stopped", work as expected.

To explore the behaviour at boot more I have created and removed various test jobs and now I find that the "debug" job does not run at all. I copied the conf file to another name and changed the "and" to an "or" and verified that that job does fire twice on boot.

I have looked at the cookbook but I can't see what I'm doing wrong. screen-cleanup is a task as well, if that makes a difference (its the file that came with the screen package apart from my additional call to date).

I'm running 13.10 though I'm hoping for something that works back to 12.04 LTS at worst.

EDIT: and after more reboots I'm back to the job triggering on the first thing to stop (networking), rather than the last (screen-cleanup). I can only assume there is an extra factor I'm not noticing.

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

The behaviour of stopped networking has changed between Ubuntu 12 and 13 because the networking job is no longer a task. That causes the stopped networking condition to fire, effectively, on system shutdown.

The times when the job seems to have fired early are presumably times when it has actually fired just before the reboot.

There is a bug report about the cookbook suggesting "stopped networking" without mentioning it's changed behaviour between releases. I have moved to static-network-up which appears to fire after ifup -a has been run so is probably much the same. The cookbook suggests this won't work on anything older than Ubuntu 11 however.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.