每当机器启动时
我正在尝试保存每次机器启动时,我的一些虚拟环境的pip冻结
的输出。因此,我最初构建了以下bash脚本:
#!/bin/bash
/home/myuser/pathtovenv/bin/pip freeze > /somepath/requirements_`date '+%Y%m%d_%H%M%S'`.txt
在终端执行它时,它可以正常工作。
因此,我添加了crontab:
@reboot cd /path_where_sh_is; ./freeze_venv.sh
还有其他一些变体:
@reboot /path_where_sh_is/freeze_venv.sh
没有成功。 这是为什么?我应该如何编写crontab系列以使其正常工作?
I am trying to save the output of pip freeze
of some of my python virtual enviroments each time my machine starts. So I initially have built the following bash script:
#!/bin/bash
/home/myuser/pathtovenv/bin/pip freeze > /somepath/requirements_`date '+%Y%m%d_%H%M%S'`.txt
It works fine when I execute it in the terminal.
So I added to the crontab:
@reboot cd /path_where_sh_is; ./freeze_venv.sh
and a few other variations:
@reboot /path_where_sh_is/freeze_venv.sh
without success.
Why is that? How should I write the crontab line to make it work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论