diff options
author | Aleksey Lim <alsroot@sugarlabs.org> | 2012-08-16 10:12:13 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@sugarlabs.org> | 2012-08-16 10:12:13 (GMT) |
commit | 08ca6835ce085f0d34d18a88238da1bee531af60 (patch) | |
tree | 2791ac6c5bc6968cc6634bf9de914b3ab972aeff | |
parent | ff3faf969c4cf3079eb339b563101cfb609bb3cb (diff) |
Make one-command service start lighter
-rwxr-xr-x | sugar-network-service | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sugar-network-service b/sugar-network-service index 280b654..d9d6890 100755 --- a/sugar-network-service +++ b/sugar-network-service @@ -147,7 +147,7 @@ class Application(application.Application): @application.command( 'start service and log to files', name='start', keep_stdout=True) - def _start(self): + def _start(self, minimal=False): if self.check_for_instance(): printf.info('%s is not run', self.name) exit(1) @@ -192,20 +192,21 @@ class Application(application.Application): if local.mounts_root.value: mounts_monitor.start(abspath(local.mounts_root.value)) - if local.delayed_start.value: - mountset.connect(delayed_start, event='delayed-start') - else: - delayed_start() - - dbus_thread.spawn_service(Datastore) - dbus_thread.spawn_service(Network) - - jobs.spawn(IPCServer(mountset).serve_forever) + if not minimal: + if local.delayed_start.value: + mountset.connect(delayed_start, event='delayed-start') + else: + delayed_start() + dbus_thread.spawn_service(Datastore) + dbus_thread.spawn_service(Network) pid_path = self.new_instance() try: mountset.open() - dbus_thread.start(mountset) + jobs.spawn(IPCServer(mountset).serve_forever) + if not minimal: + dbus_thread.start(mountset) + jobs.join() except KeyboardInterrupt: util.exception('%s interrupted', self.name) except Exception: @@ -239,7 +240,7 @@ class Application(application.Application): if not self.check_for_instance(): printf.info('%s is not started, ' \ 'launch it for this command only', self.name) - server = coroutine.spawn(self._start) + server = coroutine.spawn(self._start, True) coroutine.dispatch() Client.connection.opened.wait() |