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 "hello\n" >> /home/username/test
* * * * * /usr/bin/python3 /home/username/Bot_files/remove_done.py

second line with "hello\n" 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!

  • 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. – EnzoR May 14 '18 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.