[英]Crontab seems to execute script, but script doesn't work

Running Rhel 7: I've got a script located at /root/backups/ It backs up my influxdb shards into swift.

运行Rhel 7:我在/root/backups/backup.py上有一个脚本。它将我的Influxdb分片备份到swift中。

It has a shebang in it. When I execute this command in my shell as root:



it runs and functions correctly.


When I tell my cronjob to run it every 5 minutes, it appears as if it is running in the logs:


(root) CMD (/root/backups/

However, it looks as if it didn't actually work for some reason. When I check, the backup file in swift that this should have created is not there. It is there when I run it from the shell.


I have no idea what the problem is. I've read many things online about the path in the crontab being incorrect. However, I have other cronjobs running that are in the exact same location i.e. /root/backups/ and they are also python scripts. They run once a minute or once every 5 minutes, and they run correctly. What gives?

我不知道问题是什么。我在线阅读了很多关于crontab中路径不正确的内容。但是,我运行的其他cronjobs位于完全相同的位置,即/ root / backups /,它们也是python脚本。它们每分钟运行一次或每5分钟运行一次,它们运行正常。是什么赋予了?

I don't need any sort of authentication to backup into swift as far as I know. I ssh to the VM, run the command in my console as root without any other authentication, and it works.


1 个解决方案



Figured it out.


It was having some sort of sudo access authentication error:

它有某种sudo访问身份验证错误: -without-A-密码



粤ICP备14056181号  © 2014-2020