Crontab fails because shell path not foundScript not running in crontab, file not foundCan't access shell variable in crontab configurationRemoving Prior CrontabsCrontab script not runningCrontab not running entire script?Crontab env variables while using Dockercronjob cannot find environment variables defined in .bashrcCrontab says command not foundcrontab -e does not open the crontab for this userCannot run python script with cron
What does it exactly mean if a random variable follows a distribution
I see my dog run
Why is my log file so massive? 22gb. I am running log backups
Why do UK politicians seemingly ignore opinion polls on Brexit?
Manga about a female worker who got dragged into another world together with this high school girl and she was just told she's not needed anymore
Are white and non-white police officers equally likely to kill black suspects?
How to deal with fear of taking dependencies
COUNT(*) or MAX(id) - which is faster?
How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?
Why doesn't a const reference extend the life of a temporary object passed via a function?
Where to refill my bottle in India?
Is ipsum/ipsa/ipse a third person pronoun, or can it serve other functions?
extract characters between two commas?
Can I find out the caloric content of bread by dehydrating it?
What is it called when one voice type sings a 'solo'?
What is GPS' 19 year rollover and does it present a cybersecurity issue?
What is the command to reset a PC without deleting any files
Prime joint compound before latex paint?
Where else does the Shulchan Aruch quote an authority by name?
"My colleague's body is amazing"
"listening to me about as much as you're listening to this pole here"
Can the Produce Flame cantrip be used to grapple, or as an unarmed strike, in the right circumstances?
Lied on resume at previous job
LWC and complex parameters
Crontab fails because shell path not found
Script not running in crontab, file not foundCan't access shell variable in crontab configurationRemoving Prior CrontabsCrontab script not runningCrontab not running entire script?Crontab env variables while using Dockercronjob cannot find environment variables defined in .bashrcCrontab says command not foundcrontab -e does not open the crontab for this userCannot run python script with cron
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am looking at the failure output of my crontab.
* * * * * user /usr/bin/python3 /home/user/src/code/prod.py
I get the error /bin/sh: 1: caleb: not found.
This corresponds to
X-Cron-Env: <SHELL=/bin/sh>
which is part of the email the crontab sent me. I created the crontab using
crontab -e
All of it looks like a simple setup is there anything that I am missing?
16.04 cron
New contributor
add a comment |
I am looking at the failure output of my crontab.
* * * * * user /usr/bin/python3 /home/user/src/code/prod.py
I get the error /bin/sh: 1: caleb: not found.
This corresponds to
X-Cron-Env: <SHELL=/bin/sh>
which is part of the email the crontab sent me. I created the crontab using
crontab -e
All of it looks like a simple setup is there anything that I am missing?
16.04 cron
New contributor
3
When you runcrontab -e
it is already using your username so there is no need to add your username to the beginning of the command. The only place on the system that you add the username is in the/etc/crontab
file.
– Terrance
Apr 4 at 14:27
@Terrance that fixed my problem. i got my solution from cyberciti.biz/faq/… And I looked at the format and paid no attention to the "for system jobs"
– caleb baker
Apr 4 at 14:32
add a comment |
I am looking at the failure output of my crontab.
* * * * * user /usr/bin/python3 /home/user/src/code/prod.py
I get the error /bin/sh: 1: caleb: not found.
This corresponds to
X-Cron-Env: <SHELL=/bin/sh>
which is part of the email the crontab sent me. I created the crontab using
crontab -e
All of it looks like a simple setup is there anything that I am missing?
16.04 cron
New contributor
I am looking at the failure output of my crontab.
* * * * * user /usr/bin/python3 /home/user/src/code/prod.py
I get the error /bin/sh: 1: caleb: not found.
This corresponds to
X-Cron-Env: <SHELL=/bin/sh>
which is part of the email the crontab sent me. I created the crontab using
crontab -e
All of it looks like a simple setup is there anything that I am missing?
16.04 cron
16.04 cron
New contributor
New contributor
edited Apr 5 at 3:54
Community♦
1
1
New contributor
asked Apr 4 at 14:23
caleb bakercaleb baker
132
132
New contributor
New contributor
3
When you runcrontab -e
it is already using your username so there is no need to add your username to the beginning of the command. The only place on the system that you add the username is in the/etc/crontab
file.
– Terrance
Apr 4 at 14:27
@Terrance that fixed my problem. i got my solution from cyberciti.biz/faq/… And I looked at the format and paid no attention to the "for system jobs"
– caleb baker
Apr 4 at 14:32
add a comment |
3
When you runcrontab -e
it is already using your username so there is no need to add your username to the beginning of the command. The only place on the system that you add the username is in the/etc/crontab
file.
– Terrance
Apr 4 at 14:27
@Terrance that fixed my problem. i got my solution from cyberciti.biz/faq/… And I looked at the format and paid no attention to the "for system jobs"
– caleb baker
Apr 4 at 14:32
3
3
When you run
crontab -e
it is already using your username so there is no need to add your username to the beginning of the command. The only place on the system that you add the username is in the /etc/crontab
file.– Terrance
Apr 4 at 14:27
When you run
crontab -e
it is already using your username so there is no need to add your username to the beginning of the command. The only place on the system that you add the username is in the /etc/crontab
file.– Terrance
Apr 4 at 14:27
@Terrance that fixed my problem. i got my solution from cyberciti.biz/faq/… And I looked at the format and paid no attention to the "for system jobs"
– caleb baker
Apr 4 at 14:32
@Terrance that fixed my problem. i got my solution from cyberciti.biz/faq/… And I looked at the format and paid no attention to the "for system jobs"
– caleb baker
Apr 4 at 14:32
add a comment |
1 Answer
1
active
oldest
votes
If you are using crontab -e
that set of Cron tasks runs as the user which crontab -e
was executed as - that is, your user user
.
Therefore, you should only provide the cron entry WITHOUT the user bits, i.e.:
* * * * * /usr/bin/python3 /home/user/src/code/prod.py
The user
definition you were attempting to use should only be used in the system crontab
in /etc/crontab
and in entries in cron definitions under /etc/cron.d/
.
Not to nitpick, but the "cron user" probably has/usr/bin
in its $PATH. So,* * * * * python3 /home/user/src/code/prod.py
will probably work.
– Seamus
Apr 4 at 14:56
2
@Seamus when using crontabs it's generally better to use full paths just to rule out that problem.
– Thomas Ward♦
Apr 4 at 14:58
It's redundant... but I suppose that could be considered "generally better", for some. I'm only trying to point out that the "cron user" does have an environment, and it can be determined if it's not known.
– Seamus
Apr 4 at 15:02
1
@Seamus I often have to explain to people why their jobs that run fine from a bash prompt don't work correctly under cron (or Autosys etc.). I tell them that it's best to use the full path to everything they can, and explicitly set PATH= what they want it to be, rather than rely on "probably".
– Monty Harder
Apr 4 at 18:24
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
caleb baker is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1131213%2fcrontab-fails-because-shell-path-not-found%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you are using crontab -e
that set of Cron tasks runs as the user which crontab -e
was executed as - that is, your user user
.
Therefore, you should only provide the cron entry WITHOUT the user bits, i.e.:
* * * * * /usr/bin/python3 /home/user/src/code/prod.py
The user
definition you were attempting to use should only be used in the system crontab
in /etc/crontab
and in entries in cron definitions under /etc/cron.d/
.
Not to nitpick, but the "cron user" probably has/usr/bin
in its $PATH. So,* * * * * python3 /home/user/src/code/prod.py
will probably work.
– Seamus
Apr 4 at 14:56
2
@Seamus when using crontabs it's generally better to use full paths just to rule out that problem.
– Thomas Ward♦
Apr 4 at 14:58
It's redundant... but I suppose that could be considered "generally better", for some. I'm only trying to point out that the "cron user" does have an environment, and it can be determined if it's not known.
– Seamus
Apr 4 at 15:02
1
@Seamus I often have to explain to people why their jobs that run fine from a bash prompt don't work correctly under cron (or Autosys etc.). I tell them that it's best to use the full path to everything they can, and explicitly set PATH= what they want it to be, rather than rely on "probably".
– Monty Harder
Apr 4 at 18:24
add a comment |
If you are using crontab -e
that set of Cron tasks runs as the user which crontab -e
was executed as - that is, your user user
.
Therefore, you should only provide the cron entry WITHOUT the user bits, i.e.:
* * * * * /usr/bin/python3 /home/user/src/code/prod.py
The user
definition you were attempting to use should only be used in the system crontab
in /etc/crontab
and in entries in cron definitions under /etc/cron.d/
.
Not to nitpick, but the "cron user" probably has/usr/bin
in its $PATH. So,* * * * * python3 /home/user/src/code/prod.py
will probably work.
– Seamus
Apr 4 at 14:56
2
@Seamus when using crontabs it's generally better to use full paths just to rule out that problem.
– Thomas Ward♦
Apr 4 at 14:58
It's redundant... but I suppose that could be considered "generally better", for some. I'm only trying to point out that the "cron user" does have an environment, and it can be determined if it's not known.
– Seamus
Apr 4 at 15:02
1
@Seamus I often have to explain to people why their jobs that run fine from a bash prompt don't work correctly under cron (or Autosys etc.). I tell them that it's best to use the full path to everything they can, and explicitly set PATH= what they want it to be, rather than rely on "probably".
– Monty Harder
Apr 4 at 18:24
add a comment |
If you are using crontab -e
that set of Cron tasks runs as the user which crontab -e
was executed as - that is, your user user
.
Therefore, you should only provide the cron entry WITHOUT the user bits, i.e.:
* * * * * /usr/bin/python3 /home/user/src/code/prod.py
The user
definition you were attempting to use should only be used in the system crontab
in /etc/crontab
and in entries in cron definitions under /etc/cron.d/
.
If you are using crontab -e
that set of Cron tasks runs as the user which crontab -e
was executed as - that is, your user user
.
Therefore, you should only provide the cron entry WITHOUT the user bits, i.e.:
* * * * * /usr/bin/python3 /home/user/src/code/prod.py
The user
definition you were attempting to use should only be used in the system crontab
in /etc/crontab
and in entries in cron definitions under /etc/cron.d/
.
edited Apr 4 at 15:03
answered Apr 4 at 14:29
Thomas Ward♦Thomas Ward
45.2k23125178
45.2k23125178
Not to nitpick, but the "cron user" probably has/usr/bin
in its $PATH. So,* * * * * python3 /home/user/src/code/prod.py
will probably work.
– Seamus
Apr 4 at 14:56
2
@Seamus when using crontabs it's generally better to use full paths just to rule out that problem.
– Thomas Ward♦
Apr 4 at 14:58
It's redundant... but I suppose that could be considered "generally better", for some. I'm only trying to point out that the "cron user" does have an environment, and it can be determined if it's not known.
– Seamus
Apr 4 at 15:02
1
@Seamus I often have to explain to people why their jobs that run fine from a bash prompt don't work correctly under cron (or Autosys etc.). I tell them that it's best to use the full path to everything they can, and explicitly set PATH= what they want it to be, rather than rely on "probably".
– Monty Harder
Apr 4 at 18:24
add a comment |
Not to nitpick, but the "cron user" probably has/usr/bin
in its $PATH. So,* * * * * python3 /home/user/src/code/prod.py
will probably work.
– Seamus
Apr 4 at 14:56
2
@Seamus when using crontabs it's generally better to use full paths just to rule out that problem.
– Thomas Ward♦
Apr 4 at 14:58
It's redundant... but I suppose that could be considered "generally better", for some. I'm only trying to point out that the "cron user" does have an environment, and it can be determined if it's not known.
– Seamus
Apr 4 at 15:02
1
@Seamus I often have to explain to people why their jobs that run fine from a bash prompt don't work correctly under cron (or Autosys etc.). I tell them that it's best to use the full path to everything they can, and explicitly set PATH= what they want it to be, rather than rely on "probably".
– Monty Harder
Apr 4 at 18:24
Not to nitpick, but the "cron user" probably has
/usr/bin
in its $PATH. So, * * * * * python3 /home/user/src/code/prod.py
will probably work.– Seamus
Apr 4 at 14:56
Not to nitpick, but the "cron user" probably has
/usr/bin
in its $PATH. So, * * * * * python3 /home/user/src/code/prod.py
will probably work.– Seamus
Apr 4 at 14:56
2
2
@Seamus when using crontabs it's generally better to use full paths just to rule out that problem.
– Thomas Ward♦
Apr 4 at 14:58
@Seamus when using crontabs it's generally better to use full paths just to rule out that problem.
– Thomas Ward♦
Apr 4 at 14:58
It's redundant... but I suppose that could be considered "generally better", for some. I'm only trying to point out that the "cron user" does have an environment, and it can be determined if it's not known.
– Seamus
Apr 4 at 15:02
It's redundant... but I suppose that could be considered "generally better", for some. I'm only trying to point out that the "cron user" does have an environment, and it can be determined if it's not known.
– Seamus
Apr 4 at 15:02
1
1
@Seamus I often have to explain to people why their jobs that run fine from a bash prompt don't work correctly under cron (or Autosys etc.). I tell them that it's best to use the full path to everything they can, and explicitly set PATH= what they want it to be, rather than rely on "probably".
– Monty Harder
Apr 4 at 18:24
@Seamus I often have to explain to people why their jobs that run fine from a bash prompt don't work correctly under cron (or Autosys etc.). I tell them that it's best to use the full path to everything they can, and explicitly set PATH= what they want it to be, rather than rely on "probably".
– Monty Harder
Apr 4 at 18:24
add a comment |
caleb baker is a new contributor. Be nice, and check out our Code of Conduct.
caleb baker is a new contributor. Be nice, and check out our Code of Conduct.
caleb baker is a new contributor. Be nice, and check out our Code of Conduct.
caleb baker is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1131213%2fcrontab-fails-because-shell-path-not-found%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
When you run
crontab -e
it is already using your username so there is no need to add your username to the beginning of the command. The only place on the system that you add the username is in the/etc/crontab
file.– Terrance
Apr 4 at 14:27
@Terrance that fixed my problem. i got my solution from cyberciti.biz/faq/… And I looked at the format and paid no attention to the "for system jobs"
– caleb baker
Apr 4 at 14:32