Cannot run python script with cron

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












I have been trying to run python script using cron in regular interval and cron is not just working.
here is the result of crontab -e




6 9 * * * /etc/webmin/package-updates/update.pl
* * * * * echo "hellon" >> /home/username/test
* * * * * /usr/bin/python3 /home/username/Bot_files/remove_done.py


second line with "hellon" works fine but the last line doesn't work.

If I run it manually in terminal like

/usr/bin/python3 /home/username/Bot_files/remove_done.py

it works! that's totally driving me nut!



here is my server info

Linux server-name 4.4.0-124-generic #148-Ubuntu SMP Wed May 2 13:00:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux



I have also tried putting it inside shell script file like




* * * * bash /home/username/Bot_files/remove_done.sh


And it still doesn't work



If anyone knows solution, please help me!







share|improve this question




















  • Two questions. How do you say line #3 doesn't work? Would you pelase redirect all outpur for line #3 with something like > /tmp/somelog 2>&1? You'd get both stdout and stderr output to that file.
    – Uqbar
    May 14 at 17:43















up vote
0
down vote

favorite












I have been trying to run python script using cron in regular interval and cron is not just working.
here is the result of crontab -e




6 9 * * * /etc/webmin/package-updates/update.pl
* * * * * echo "hellon" >> /home/username/test
* * * * * /usr/bin/python3 /home/username/Bot_files/remove_done.py


second line with "hellon" works fine but the last line doesn't work.

If I run it manually in terminal like

/usr/bin/python3 /home/username/Bot_files/remove_done.py

it works! that's totally driving me nut!



here is my server info

Linux server-name 4.4.0-124-generic #148-Ubuntu SMP Wed May 2 13:00:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux



I have also tried putting it inside shell script file like




* * * * bash /home/username/Bot_files/remove_done.sh


And it still doesn't work



If anyone knows solution, please help me!







share|improve this question




















  • Two questions. How do you say line #3 doesn't work? Would you pelase redirect all outpur for line #3 with something like > /tmp/somelog 2>&1? You'd get both stdout and stderr output to that file.
    – Uqbar
    May 14 at 17:43













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have been trying to run python script using cron in regular interval and cron is not just working.
here is the result of crontab -e




6 9 * * * /etc/webmin/package-updates/update.pl
* * * * * echo "hellon" >> /home/username/test
* * * * * /usr/bin/python3 /home/username/Bot_files/remove_done.py


second line with "hellon" works fine but the last line doesn't work.

If I run it manually in terminal like

/usr/bin/python3 /home/username/Bot_files/remove_done.py

it works! that's totally driving me nut!



here is my server info

Linux server-name 4.4.0-124-generic #148-Ubuntu SMP Wed May 2 13:00:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux



I have also tried putting it inside shell script file like




* * * * bash /home/username/Bot_files/remove_done.sh


And it still doesn't work



If anyone knows solution, please help me!







share|improve this question












I have been trying to run python script using cron in regular interval and cron is not just working.
here is the result of crontab -e




6 9 * * * /etc/webmin/package-updates/update.pl
* * * * * echo "hellon" >> /home/username/test
* * * * * /usr/bin/python3 /home/username/Bot_files/remove_done.py


second line with "hellon" works fine but the last line doesn't work.

If I run it manually in terminal like

/usr/bin/python3 /home/username/Bot_files/remove_done.py

it works! that's totally driving me nut!



here is my server info

Linux server-name 4.4.0-124-generic #148-Ubuntu SMP Wed May 2 13:00:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux



I have also tried putting it inside shell script file like




* * * * bash /home/username/Bot_files/remove_done.sh


And it still doesn't work



If anyone knows solution, please help me!









share|improve this question











share|improve this question




share|improve this question










asked May 14 at 16:39









zmt27

1




1











  • Two questions. How do you say line #3 doesn't work? Would you pelase redirect all outpur for line #3 with something like > /tmp/somelog 2>&1? You'd get both stdout and stderr output to that file.
    – Uqbar
    May 14 at 17:43

















  • Two questions. How do you say line #3 doesn't work? Would you pelase redirect all outpur for line #3 with something like > /tmp/somelog 2>&1? You'd get both stdout and stderr output to that file.
    – Uqbar
    May 14 at 17:43
















Two questions. How do you say line #3 doesn't work? Would you pelase redirect all outpur for line #3 with something like > /tmp/somelog 2>&1? You'd get both stdout and stderr output to that file.
– Uqbar
May 14 at 17:43





Two questions. How do you say line #3 doesn't work? Would you pelase redirect all outpur for line #3 with something like > /tmp/somelog 2>&1? You'd get both stdout and stderr output to that file.
– Uqbar
May 14 at 17:43
















active

oldest

votes











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',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1036182%2fcannot-run-python-script-with-cron%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1036182%2fcannot-run-python-script-with-cron%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Unable to execute new pre-installation script (/var/lib/dpkg/tmp.ci/preinst)

Running the scala interactive shell from the command line

Do not install recommended packages of dependencies