code: def focusd(task):
      
  
      # determine if command server should be started
      if registration.get_registered(event_hooks=True, root_access=True):
          # root event plugins available
          start_cmd_srv = (os.getuid() == 0)  # must be root
      else:
          start_cmd_srv = False
  
      # daemonize our current process
      _run = lambda: Focusd(task).run(start_cmd_srv)
      daemonize(get_daemon_pidfile(task), task.task_dir, _run)
docs: Forks the current process as a daemon to run a task.
  
          `task`
              ``Task`` instance for the task to run.