Merge lp:~jml/launchpad/robust-shutdown into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 11224
Proposed branch: lp:~jml/launchpad/robust-shutdown
Merge into: lp:launchpad
Diff against target: 14 lines (+1/-3)
1 file modified
lib/devscripts/ec2test/testrunner.py (+1/-3)
To merge this branch: bzr merge lp:~jml/launchpad/robust-shutdown
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Martin Pool (community) Approve
Review via email: mp+30888@code.launchpad.net

Commit message

Timeout ec2 instances using shutdown rather than at.

Description of the change

Follow Martin Pool's recommendations for a more robust timeout on ec2 instances.

----
I observed this message trying to start a remote test run:

 ec2test@...$ echo sudo shutdown -h now | at today + 480 minutes
 warning: commands will be executed using /bin/sh
 job 1 at Sat Jul 24 22:43:00 2010
 Can't open /var/run/atd.pid to signal atd. No atd running?

I wonder if this could be responsible for some people seeing their
instances never shut down? It doesn't happen every time. I wonder
too if this could be caused by poking commands into the machine right
after it's started up and therefore before atd is ready to signal
commands? Perhaps we should just run 'sudo -b shutdown -h +480'?

To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

seems plausible to me :-)

(but there are not (yet) any revisions in the mp)

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

%d might guard against None; or perhaps its already guarded.

review: Approve
Revision history for this message
Gavin Panella (allenap) wrote :

shutdown -h +X will just sit there for X minutes, so I think this needs to be backgrounded or double forked or something.

Revision history for this message
Gavin Panella (allenap) wrote :

Of course, I've just seen sudo -b, so ignore my last comment :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/devscripts/ec2test/testrunner.py'
2--- lib/devscripts/ec2test/testrunner.py 2010-06-04 13:40:55 +0000
3+++ lib/devscripts/ec2test/testrunner.py 2010-07-25 10:46:01 +0000
4@@ -318,9 +318,7 @@
5 def configure_system(self):
6 user_connection = self._instance.connect()
7 if self.timeout is not None:
8- user_connection.perform(
9- "echo sudo shutdown -h now | at today + %d minutes"
10- % self.timeout)
11+ user_connection.perform("sudo -b shutdown -h +%s" % self.timeout)
12 as_user = user_connection.perform
13 # Set up bazaar.conf with smtp information if necessary
14 if self.email or self.message: