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'm setting up an Ubuntu instance on Amazon EC2 and I'm trying to configure it so that, at startup, it automatically attaches an EBS volume and takes an elastic IP address and, at shutdown, it automatically releases those resources.

I found various init scripts that do what I want, but I'd really like to use an upstart job, so that I can automatically install it through cloud-init.

I understand from this exchange that the event I want to monitor to start my job is, for lucid and maverick

start on stopped cloud-run-user-script

and for natty

start on stopped cloud-final

Is this really accurate? Also, what is the correct event to monitor to stop my job (including unmounting and detaching the EBS volume and releasing the elastic IP)?

share|improve this question
    
start on stopped cloud-final still works on saucy –  Luke Chadwick Mar 12 at 2:44
add comment

1 Answer

up vote 2 down vote accepted

The events are correct if you specifically need to run when cloud-init has finished. You probably will want your script to be done with the keyword task, so that the bits that depend on cloud-init are blocked until your script finishes.

For shutdown

start on runlevel [016]

Will run something as the normal system shutdown is happening.

Note that there's a wealth of information about these things in the upstart cookbook:

http://upstart.ubuntu.com/cookbook/

share|improve this answer
    
Thank you. I didn't notice the cookbook in my searches... –  tawmas May 18 '11 at 11:37
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.