cwctl.py
changeset 9340 b1e933b0e850
parent 9288 823cf14bcc37
parent 9323 29d2f15cf596
child 9371 1348202527a6
--- a/cwctl.py	Mon Sep 09 12:43:25 2013 +0200
+++ b/cwctl.py	Mon Dec 09 16:13:10 2013 +0100
@@ -746,6 +746,7 @@
         print '\n' + underline_title('Upgrading the instance %s' % appid)
         from logilab.common.changelog import Version
         config = cwcfg.config_for(appid)
+        instance_running = exists(config['pid-file'])
         config.repairing = True # notice we're not starting the server
         config.verbosity = self.config.verbosity
         set_sources_mode = getattr(config, 'set_sources_mode', None)
@@ -777,7 +778,7 @@
         if cubicwebversion > applcubicwebversion:
             toupgrade.append(('cubicweb', applcubicwebversion, cubicwebversion))
         # only stop once we're sure we have something to do
-        if not (CWDEV or self.config.nostartstop):
+        if instance_running and not (CWDEV or self.config.nostartstop):
             StopInstanceCommand(self.logger).stop_instance(appid)
         # run cubicweb/componants migration scripts
         if self.config.fs_only or toupgrade:
@@ -794,7 +795,7 @@
             return
         print
         print '-> instance migrated.'
-        if not (CWDEV or self.config.nostartstop):
+        if instance_running and not (CWDEV or self.config.nostartstop):
             # restart instance through fork to get a proper environment, avoid
             # uicfg pb (and probably gettext catalogs, to check...)
             forkcmd = '%s start %s' % (sys.argv[0], appid)