Crontab mail issue
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have python script
which sends email by shell function
"mail". It runs fine. However, when I put in crontab to run it is unable to send mail to the recipient, rather it sends error message to my address. Is there any issue that crontab cannot send mail running via another script?
Here is my crontab entry:
30 8 * * * /home/akand/./pyscript.py
The pyscript.py has
import os
os.system(''' mail -s "Message" ...@gmail.com <<< "Please
check ..." ''')
As I mentioned, pyscript.py
runs fine.
cron email
 |Â
show 1 more comment
up vote
0
down vote
favorite
I have python script
which sends email by shell function
"mail". It runs fine. However, when I put in crontab to run it is unable to send mail to the recipient, rather it sends error message to my address. Is there any issue that crontab cannot send mail running via another script?
Here is my crontab entry:
30 8 * * * /home/akand/./pyscript.py
The pyscript.py has
import os
os.system(''' mail -s "Message" ...@gmail.com <<< "Please
check ..." ''')
As I mentioned, pyscript.py
runs fine.
cron email
1
Please edit your question to include the crontab entry that you are using.
â Kusalananda
Apr 10 at 15:11
Although I have edited tags, it doesn't show, at least not from my end.
â Akand
Apr 10 at 15:38
You have an issue with your cron job and to see what the issue is, we would need to see what your crontab entry looks like. Please add the output ofcrontab -l
(or just the specific entry) into the text of the question.
â Kusalananda
Apr 10 at 15:40
1
What's the error message? Is it an empty body or recipient? You may have an interactive environment variable that's not being set by cron.
â Jeff Schaller
Apr 10 at 16:09
In dead.letter following is produced: To: found, not, command, line....@gmail.com Subject: Message: ...... User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
â Akand
Apr 10 at 16:40
 |Â
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have python script
which sends email by shell function
"mail". It runs fine. However, when I put in crontab to run it is unable to send mail to the recipient, rather it sends error message to my address. Is there any issue that crontab cannot send mail running via another script?
Here is my crontab entry:
30 8 * * * /home/akand/./pyscript.py
The pyscript.py has
import os
os.system(''' mail -s "Message" ...@gmail.com <<< "Please
check ..." ''')
As I mentioned, pyscript.py
runs fine.
cron email
I have python script
which sends email by shell function
"mail". It runs fine. However, when I put in crontab to run it is unable to send mail to the recipient, rather it sends error message to my address. Is there any issue that crontab cannot send mail running via another script?
Here is my crontab entry:
30 8 * * * /home/akand/./pyscript.py
The pyscript.py has
import os
os.system(''' mail -s "Message" ...@gmail.com <<< "Please
check ..." ''')
As I mentioned, pyscript.py
runs fine.
cron email
edited Apr 11 at 15:33
Debian_yadav
8342522
8342522
asked Apr 10 at 15:09
Akand
426
426
1
Please edit your question to include the crontab entry that you are using.
â Kusalananda
Apr 10 at 15:11
Although I have edited tags, it doesn't show, at least not from my end.
â Akand
Apr 10 at 15:38
You have an issue with your cron job and to see what the issue is, we would need to see what your crontab entry looks like. Please add the output ofcrontab -l
(or just the specific entry) into the text of the question.
â Kusalananda
Apr 10 at 15:40
1
What's the error message? Is it an empty body or recipient? You may have an interactive environment variable that's not being set by cron.
â Jeff Schaller
Apr 10 at 16:09
In dead.letter following is produced: To: found, not, command, line....@gmail.com Subject: Message: ...... User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
â Akand
Apr 10 at 16:40
 |Â
show 1 more comment
1
Please edit your question to include the crontab entry that you are using.
â Kusalananda
Apr 10 at 15:11
Although I have edited tags, it doesn't show, at least not from my end.
â Akand
Apr 10 at 15:38
You have an issue with your cron job and to see what the issue is, we would need to see what your crontab entry looks like. Please add the output ofcrontab -l
(or just the specific entry) into the text of the question.
â Kusalananda
Apr 10 at 15:40
1
What's the error message? Is it an empty body or recipient? You may have an interactive environment variable that's not being set by cron.
â Jeff Schaller
Apr 10 at 16:09
In dead.letter following is produced: To: found, not, command, line....@gmail.com Subject: Message: ...... User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
â Akand
Apr 10 at 16:40
1
1
Please edit your question to include the crontab entry that you are using.
â Kusalananda
Apr 10 at 15:11
Please edit your question to include the crontab entry that you are using.
â Kusalananda
Apr 10 at 15:11
Although I have edited tags, it doesn't show, at least not from my end.
â Akand
Apr 10 at 15:38
Although I have edited tags, it doesn't show, at least not from my end.
â Akand
Apr 10 at 15:38
You have an issue with your cron job and to see what the issue is, we would need to see what your crontab entry looks like. Please add the output of
crontab -l
(or just the specific entry) into the text of the question.â Kusalananda
Apr 10 at 15:40
You have an issue with your cron job and to see what the issue is, we would need to see what your crontab entry looks like. Please add the output of
crontab -l
(or just the specific entry) into the text of the question.â Kusalananda
Apr 10 at 15:40
1
1
What's the error message? Is it an empty body or recipient? You may have an interactive environment variable that's not being set by cron.
â Jeff Schaller
Apr 10 at 16:09
What's the error message? Is it an empty body or recipient? You may have an interactive environment variable that's not being set by cron.
â Jeff Schaller
Apr 10 at 16:09
In dead.letter following is produced: To: found, not, command, line....@gmail.com Subject: Message: ...... User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
â Akand
Apr 10 at 16:40
In dead.letter following is produced: To: found, not, command, line....@gmail.com Subject: Message: ...... User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
â Akand
Apr 10 at 16:40
 |Â
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
As Jeff mentioned, the environment variable was not passing. The command in crontab:
30 8 * * * $HOME/.bash_profile; /home/akand/./pyscript.py
worked.
I would have understood that it would work with. "$HOME/.bash_profile"
, but as you have written it now, it just runs.bash_profile
as a script. That means that the environment variables are not passed on to the Python script.
â Kusalananda
Apr 11 at 15:26
If I understand well, the pyscript.py is in my home directory, that's the reason I do not need to specify <. "$HOME/.bash_profile" >
â Akand
Apr 11 at 15:37
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
As Jeff mentioned, the environment variable was not passing. The command in crontab:
30 8 * * * $HOME/.bash_profile; /home/akand/./pyscript.py
worked.
I would have understood that it would work with. "$HOME/.bash_profile"
, but as you have written it now, it just runs.bash_profile
as a script. That means that the environment variables are not passed on to the Python script.
â Kusalananda
Apr 11 at 15:26
If I understand well, the pyscript.py is in my home directory, that's the reason I do not need to specify <. "$HOME/.bash_profile" >
â Akand
Apr 11 at 15:37
add a comment |Â
up vote
0
down vote
accepted
As Jeff mentioned, the environment variable was not passing. The command in crontab:
30 8 * * * $HOME/.bash_profile; /home/akand/./pyscript.py
worked.
I would have understood that it would work with. "$HOME/.bash_profile"
, but as you have written it now, it just runs.bash_profile
as a script. That means that the environment variables are not passed on to the Python script.
â Kusalananda
Apr 11 at 15:26
If I understand well, the pyscript.py is in my home directory, that's the reason I do not need to specify <. "$HOME/.bash_profile" >
â Akand
Apr 11 at 15:37
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
As Jeff mentioned, the environment variable was not passing. The command in crontab:
30 8 * * * $HOME/.bash_profile; /home/akand/./pyscript.py
worked.
As Jeff mentioned, the environment variable was not passing. The command in crontab:
30 8 * * * $HOME/.bash_profile; /home/akand/./pyscript.py
worked.
edited Apr 11 at 15:24
Kusalananda
102k13200317
102k13200317
answered Apr 11 at 15:22
Akand
426
426
I would have understood that it would work with. "$HOME/.bash_profile"
, but as you have written it now, it just runs.bash_profile
as a script. That means that the environment variables are not passed on to the Python script.
â Kusalananda
Apr 11 at 15:26
If I understand well, the pyscript.py is in my home directory, that's the reason I do not need to specify <. "$HOME/.bash_profile" >
â Akand
Apr 11 at 15:37
add a comment |Â
I would have understood that it would work with. "$HOME/.bash_profile"
, but as you have written it now, it just runs.bash_profile
as a script. That means that the environment variables are not passed on to the Python script.
â Kusalananda
Apr 11 at 15:26
If I understand well, the pyscript.py is in my home directory, that's the reason I do not need to specify <. "$HOME/.bash_profile" >
â Akand
Apr 11 at 15:37
I would have understood that it would work with
. "$HOME/.bash_profile"
, but as you have written it now, it just runs .bash_profile
as a script. That means that the environment variables are not passed on to the Python script.â Kusalananda
Apr 11 at 15:26
I would have understood that it would work with
. "$HOME/.bash_profile"
, but as you have written it now, it just runs .bash_profile
as a script. That means that the environment variables are not passed on to the Python script.â Kusalananda
Apr 11 at 15:26
If I understand well, the pyscript.py is in my home directory, that's the reason I do not need to specify <. "$HOME/.bash_profile" >
â Akand
Apr 11 at 15:37
If I understand well, the pyscript.py is in my home directory, that's the reason I do not need to specify <. "$HOME/.bash_profile" >
â Akand
Apr 11 at 15:37
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436798%2fcrontab-mail-issue%23new-answer', 'question_page');
);
Post as a guest
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
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
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
1
Please edit your question to include the crontab entry that you are using.
â Kusalananda
Apr 10 at 15:11
Although I have edited tags, it doesn't show, at least not from my end.
â Akand
Apr 10 at 15:38
You have an issue with your cron job and to see what the issue is, we would need to see what your crontab entry looks like. Please add the output of
crontab -l
(or just the specific entry) into the text of the question.â Kusalananda
Apr 10 at 15:40
1
What's the error message? Is it an empty body or recipient? You may have an interactive environment variable that's not being set by cron.
â Jeff Schaller
Apr 10 at 16:09
In dead.letter following is produced: To: found, not, command, line....@gmail.com Subject: Message: ...... User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
â Akand
Apr 10 at 16:40