import logging
import os

def reconfigure(args):
    config = args.config
    logger = logging.getLogger('lobster.reconfigure')

    cmd = 'config.{} = {}'.format(args.setting, args.value)
    logger.info("sending command: " + cmd)
    logger.info("check the log of the main process for success")

    icp = open(os.path.join(config.workdir, 'ipc'), 'w')
    icp.write(cmd)

@@ -19,16 +19,77 @@
 ort os%0A%0A
+from lobster import util%0Afrom lockfile import AlreadyLocked%0A%0A
 def reco
@@ -191,64 +191,504 @@
     
-cmd = 'config.%7B%7D = %7B%7D'.format(args.setting, args.value)%0A
+try:%0A        pidfile = util.get_lock(config.workdir)%0A        logger.info(%22Lobster process not running, directly changing configuration.%22)%0A        with util.PartiallyMutable.lockdown():%0A            cmd = 'config.%7B%7D = %7B%7D'.format(args.setting, args.value)%0A            exec cmd in %7B'config': config%7D, %7B%7D%0A            config.save()%0A    except AlreadyLocked:%0A        logger.info(%22Lobster process still running, contacting process...%22)%0A        cmd = 'config.%7B%7D = %7B%7D'.format(args.setting, args.value)%0A    
     
@@ -726,16 +726,20 @@
  + cmd)%0A
+    
     logg
@@ -800,16 +800,20 @@
 %22)%0A%0A    
+  
+  
 icp = op
@@ -857,16 +857,20 @@
 ), 'w')%0A
+    
     icp.
@@ -876,12 +876,97 @@
 .write(cmd)%0A
+    except Exception as e:%0A        logger.error(%22can't change values: %7B%7D%22.format(e))%0A

Allow to reconfigure a Lobster project that isn't running.