def start(config_name: str, foreground: bool): """Starts the Maestral as a daemon.""" from maestral.daemon import get_maestral_pid from maestral.utils.backend import pending_dropbox_folder # do nothing if already running if get_maestral_pid(config_name): click.echo('Maestral daemon is already running.') return from maestral.main import Maestral # run setup if not yet done if pending_link_cli(config_name) or pending_dropbox_folder(config_name): m = Maestral(config_name, run=False) m.reset_sync_state() m.create_dropbox_directory() m.set_excluded_items() del m # start daemon if foreground: from maestral.daemon import run_maestral_daemon run_maestral_daemon(config_name, run=True, log_to_stdout=True) else: start_daemon_subprocess_with_cli_feedback(config_name)
def start(config_name: str, foreground: bool, verbose: bool): """Starts the Maestral as a daemon.""" from maestral.daemon import get_maestral_pid from maestral.utils.backend import pending_dropbox_folder # do nothing if already running if get_maestral_pid(config_name): click.echo('Maestral daemon is already running.') return # run setup if not yet done if pending_link_cli(config_name) or pending_dropbox_folder(config_name): from maestral.main import Maestral m = Maestral(config_name, run=False) m.reset_sync_state() m.create_dropbox_directory() exclude_folders_q = click.confirm( 'Would you like to exclude any folders from syncing?', default=False, ) if exclude_folders_q: click.echo( 'Please choose which top-level folders to exclude. You can exclude\n' 'individual files or subfolders later with "maestral excluded add".' ) m.set_excluded_items() del m # start daemon if foreground: from maestral.daemon import run_maestral_daemon run_maestral_daemon(config_name, run=True, log_to_stdout=verbose) else: start_daemon_subprocess_with_cli_feedback(config_name, log_to_stdout=verbose)