docs: def dbserver(cmd, dbhostport=None,
               dbpath=os.path.expanduser(config.dbserver.file)):
      """
      start/stop/restart the database server, or return its status
      """
      if config.dbserver.multi_user and getpass.getuser() != 'openquake':
          sys.exit('oq dbserver only works in single user mode')
  
      status = dbs.get_status()
      if cmd == 'status':
          print('dbserver ' + status)
      elif cmd == 'stop':
          if status == 'running':
              pid = logs.dbcmd('getpid')
              os.kill(pid, signal.SIGINT)  # this is trapped by the DbServer
          else:
              print('dbserver already stopped')
      elif cmd == 'start':
          if status == 'not-running':
              dbs.run_server(dbpath, dbhostport)
          else:
              print('dbserver already running')
      elif cmd == 'restart':
          if status == 'running':
              pid = logs.dbcmd('getpid')
              os.kill(pid, signal.SIGINT)
          dbs.run_server(dbpath, dbhostport)