Bash cron作业不会像在命令行上那样执行(Bash cron job doesn't execute like it does on command line)
我编写了一个执行python脚本的bash脚本,将文件写入目录,然后将该文件发送到Amazon S3。 当我从命令行执行脚本时它完全执行,但是当我用cron运行它时,文件写入目录,但永远不会被发送到S3。 我必须对cron做错事。
这是bash脚本:
#!/bin/bash #python script that exports file to home directory python some_script.py #export file created by python to S3 s3cmd put /home/bitnami/myfile.csv s3://location/to/put/file/myfile.csv
就像我之前说过的那样,使用
./bash_script.sh
手动执行工作正常。 当我设置cron作业时,文件会写入目录,但永远不会被发送到S3。我的cron工作是:
18 * * * * /home/bitnami/bash_script.sh
我错误地使用了cron吗? 请帮忙。
I've written a bash script that executes a python script to write a file to a directory, then sends that file to Amazon S3. When I execute the script from the command line it executes perfectly, but when I run it with cron, the file writes to the directory, but never gets sent to S3. I must be doing something wrong with cron.
Here is the bash script:
#!/bin/bash #python script that exports file to home directory python some_script.py #export file created by python to S3 s3cmd put /home/bitnami/myfile.csv s3://location/to/put/file/myfile.csv
Like I said before, manually executing works fine using
./bash_script.sh
. When I set up the cron job, the file writes to the directory, but never gets sent to S3.my cron job is:
18 * * * * /home/bitnami/bash_script.sh
Am I using cron incorrectly? Please help.
原文:https://stackoverflow.com/questions/29086371
最满意答案
假设你还没有推动任何事情,你的历史看起来像这样
A -- B -- C -- D -- E ^ ^ | | origin/master master
您可以执行以下操作:
git branch feature git reset origin/master
得到这个:
A -- B -- C -- D -- E ^ ^ | | | feature origin/master,master
Assuming you have't pushed anything yet and your history looks something like
A -- B -- C -- D -- E ^ ^ | | origin/master master
You can just do the following:
git branch feature git reset origin/master
to get this:
A -- B -- C -- D -- E ^ ^ | | | feature origin/master,master
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
假设你还没有推动任何事情,你的历史看起来像这样 A -- B -- C -- D -- E ^ ^ | | origin/master master 您可以执行以下操作: git branch feature git reset origin/master 得到这个: A -- B -- C -- D -- E ^ ^ | | | ...
-
克隆只有一个分支[复制](Clone only one branch [duplicate])[2022-09-24]
从公告Git 1.7.10 (2012年4月): git clone学习--single-branch选项将克隆限制到单个分支(惊喜!); 不指向分支的历史记录的标签不会被获取。 Git实际上只允许克隆一个分支,例如: git clone -b mybranch --single-branch git://sub.domain.com/repo.git 注意 : 您还可以添加另一个分支或“撤消”此操作。 From the announcement Git 1.7.10 (April 2012): git ... -
git init git remote add -t refspec remotename host:/dir.git git fetch 但是如果我记得正确,默认情况下,克隆从远程而不是当前工作分支获取所有分支。 Please see also the other answer which many people prefer. You may also want to make sure you understand the difference. And the difference is: by ...
-
git branch默认只显示本地分支; 使用git branch -r查看远程分支或git branch -a查看全部。 git clone仅创建一个本地分支,默认情况下为master ,它跟踪(同样默认情况下)远程存储库上的master分支。 git branch only shows local branches by default; use git branch -r to see remote branches or git branch -a to see all. git clone onl ...
-
Git拉/克隆一个分支(Git pull/clone a branch)[2023-10-02]
如果您在以下方面遇到错误: git clone git@bitbucket.org:name/name.git -b mv_LookbookAddition --single-branch 这意味着您需要1.7.10+(2012年6月),对于Linux,使用ppa或git-scm.com/download/mac for Mac。 但是,您将获得分支的完整历史记录(如果该分支是从master创建的,则将从master分支获得所有提交,直到分支开始,再加上分支提交) 您可以尝试合并--depth选项以仅从分 ... -
默认情况下,在克隆操作之后,您将位于已在git配置中标记为默认分支的分支上。 假设您正在使用GitHub,可以通过“设置”页面进行配置: 一旦克隆了存储库,就可以执行git checkout
进入您感兴趣的分支。 或者,您可以更改默认分支(如果这对您和您的团队有意义)。 By default, following the clone operation, you will be on the branch that has been marked as the default bra ... -
从GIT克隆一个分支(clone a branch from GIT)[2024-02-23]
您没有克隆分支,克隆整个项目: $ git clone git://github.com/openstack/neutron Cloning into 'neutron'... remote: Counting objects: 105856, done. remote: Total 105856 (delta 0), reused 0 (delta 0) Receiving objects: 100% (105856/105856), 44.17 MiB | 1.06 MiB/s, done. Resol ... -
GIT - 克隆本地分支(GIT - Clone local branch)[2024-01-20]
为精致的问题发布另一个答案。 如果这将更难以合作,以什么方式? 这样做有什么陷阱? 我需要采取哪些步骤将这些更改合并到主服务器中? 就像我在第一个答案中提到的那样,每个克隆都是一个单独的存储库,但是指向相同的Git URI,即//[...]/project_1.git ,即仅通过remote连接到彼此。 使用上图解释, 要通过[local-Bug Fixes]的发展更新[local-Main],只有两种方法: 通过命令行: push [local-Bug Fixes] git push origin bug ...