问题 运行 从 cron 重新思考数据库转储
Problems running rethinkdb-dump from cron
我正在尝试设置 rethinkdb 的定期备份,但一直 运行ning 遇到问题。您如何从 cron 将 rethinkdb-dump 设置为 运行?
这是我的脚本:
$ cat backup.sh
#!/bin/bash
NOW=$(date +"%Y-%m-%d-%H-%M")
/usr/bin/rethinkdb dump -e my_db -f /root/db_backup/$NOW.tar.gz
当我手动 运行 时,脚本 运行 很好。但是,当从 cron 尝试 运行 它时,它不起作用,我在 stderr
:
得到以下信息
Error when launching 'rethinkdb-dump': No such file or directory
The rethinkdb-dump command depends on the RethinkDB Python driver, which must be installed.
If the Python driver is already installed, make sure that the PATH environment variable
includes the location of the backup scripts, and that the current user has permission to
access and run the scripts.
Instructions for installing the RethinkDB Python driver are available here:
http://www.rethinkdb.com/docs/install-drivers/python/
这似乎是一个 Python 环境问题,但我不知道如何让它开心...想法?求助!
当您从那个 backup.sh 脚本 运行 时,它可能 运行 没有正确的 PATH 设置并且无法找到 rethinkdb-dump
的 PATH。
首先,让我们找出rethinkdb-dump
在哪里
which rethinkdb-dump
(on my pc, I guess it's very different on your pc)
/usr/local/bin/rethinkdb-dump
现在,尝试将 PATH 附加到您的脚本 backup.sh
#!/bin/bash
export PATH="$PATH:/path/to/folder/contain-rethinkdb-dump"
# The rest of your script normally
以我为例,我会这样说:
export PATH="$PATH:/usr/local/bin"
我认为你的 rethinkdb-dump
生活在正常 bin
文件夹之外(/usr/bin、/usr/local/bin 等)
windows 的 python 安装程序在此处的子文件夹中安装脚本和包:
$env:APPDATA\Python\Python37
对于 powershell
%APPDATA%\Python\Python37
对于 cmd
cd
这个目录看/Scripts和/site-packages(pip packages)
我正在尝试设置 rethinkdb 的定期备份,但一直 运行ning 遇到问题。您如何从 cron 将 rethinkdb-dump 设置为 运行?
这是我的脚本:
$ cat backup.sh
#!/bin/bash
NOW=$(date +"%Y-%m-%d-%H-%M")
/usr/bin/rethinkdb dump -e my_db -f /root/db_backup/$NOW.tar.gz
当我手动 运行 时,脚本 运行 很好。但是,当从 cron 尝试 运行 它时,它不起作用,我在 stderr
:
Error when launching 'rethinkdb-dump': No such file or directory
The rethinkdb-dump command depends on the RethinkDB Python driver, which must be installed.
If the Python driver is already installed, make sure that the PATH environment variable
includes the location of the backup scripts, and that the current user has permission to
access and run the scripts.
Instructions for installing the RethinkDB Python driver are available here:
http://www.rethinkdb.com/docs/install-drivers/python/
这似乎是一个 Python 环境问题,但我不知道如何让它开心...想法?求助!
当您从那个 backup.sh 脚本 运行 时,它可能 运行 没有正确的 PATH 设置并且无法找到 rethinkdb-dump
的 PATH。
首先,让我们找出rethinkdb-dump
which rethinkdb-dump
(on my pc, I guess it's very different on your pc)
/usr/local/bin/rethinkdb-dump
现在,尝试将 PATH 附加到您的脚本 backup.sh
#!/bin/bash
export PATH="$PATH:/path/to/folder/contain-rethinkdb-dump"
# The rest of your script normally
以我为例,我会这样说:
export PATH="$PATH:/usr/local/bin"
我认为你的 rethinkdb-dump
生活在正常 bin
文件夹之外(/usr/bin、/usr/local/bin 等)
windows 的 python 安装程序在此处的子文件夹中安装脚本和包:
$env:APPDATA\Python\Python37
对于 powershell
%APPDATA%\Python\Python37
对于 cmd
cd
这个目录看/Scripts和/site-packages(pip packages)