如何检查orientdb服务器是否在sudo上运行?

2024-06-27 02:33:16 发布

您现在位置:Python中文网/ 问答频道 /正文

def orientdb_http_server_status():
    url = "http://{0}:{1}/server".format(settings.ORIENT_DB_CONFIG['url'], settings.ORIENT_DB_CONFIG['port'])
    request = requests.get(url,
                            auth=basic_auth)
    return request.json()

现在我调用上面的函数,以确保在启动服务之前orientdb已启动。但是,如果我没有在没有“sudo”的情况下启动orientDB服务器,则上述函数将通过。从那时起,我所有的API调用都失败了,因为我没有用sudo命令启动orientdb服务器。这是我得到的错误。你知道吗

$ANSI{green {db=dinbog}} Error during file initialization for storage 'dinbog'
java.io.FileNotFoundException: /home/cegprakash/workspace/orientdb-community-2.2.35/databases/dinbog/dinbog.18.wal (Permission denied)

如何在启动web服务之前检查orientDB是否具有sudo权限?你知道吗


Tags: 函数服务器authconfighttpurldbsettings
1条回答
网友
1楼 · 发布于 2024-06-27 02:33:16

您可以这样检查uid:

python -c 'import os; print os.getuid()'
213412

sudo python -c 'import os; print os.getuid()'
0

sudo为0。你知道吗

相关问题 更多 >