# # # patch "cmd_netsync.cc" # from [17199b154899d9bfb5c99f02f1c9e6c5d8b1c9e5] # to [073c470b8682f791dc005e7b79eaa9e645a5aa92] # # patch "options_list.hh" # from [44bb545b06f4a7d22e4a5440283b7ac329903137] # to [f4131df608d02b601e9f562d961072cc98fb5f7e] # ============================================================ --- cmd_netsync.cc 17199b154899d9bfb5c99f02f1c9e6c5d8b1c9e5 +++ cmd_netsync.cc 073c470b8682f791dc005e7b79eaa9e645a5aa92 @@ -474,7 +474,8 @@ CMD_NO_WORKSPACE(serve, "serve", "", CMD N_("Serves the database to connecting clients"), "", options::opts::bind | options::opts::pidfile | - options::opts::bind_stdio | options::opts::no_transport_auth ) + options::opts::bind_stdio | options::opts::no_transport_auth | + options::opts::daemon) { if (!args.empty()) throw usage(execid); @@ -497,6 +498,10 @@ CMD_NO_WORKSPACE(serve, "serve", "", CMD app.db.ensure_open(); + if (app.opts.daemon) + E(daemon(0, 0) == 0, + F("call to daemon failed!")); + run_netsync_protocol(server_voice, source_and_sink_role, app.opts.bind_uris, globish("*"), globish(""), app); } ============================================================ --- options_list.hh 44bb545b06f4a7d22e4a5440283b7ac329903137 +++ options_list.hh f4131df608d02b601e9f562d961072cc98fb5f7e @@ -70,6 +70,14 @@ OPTION(branch, branch, true, "branch,b", } #endif +OPT(daemon, "daemon", bool, false, + gettext_noop("detach from terminal and background to run as a system process")) +#ifdef option_bodies +{ + daemon = true; +} +#endif + OPT(brief, "brief", bool, false, gettext_noop("print a brief version of the normal output")) #ifdef option_bodies