D
D
Denis Michurin2017-07-16 14:17:37
linux
Denis Michurin, 2017-07-16 14:17:37

cron job not working?

I can't figure out why the script doesn't run in cron. The script itself works. Must run let's say at 14:10 every day. But why doesn't he want to

# m h  dom mon dow   command
10 14 * * * /root/MyFunnyEnglishBOT/bot.sh

UPD: It's strange, but in the cron-a logs it says that the script was supposedly executed, but in fact it was not. Also, for the sake of experiment, I decided to check the call to the banal echo console. The logs say that it was, in reality I didn’t see it in the console.
Maybe it means something, but I see it on the server via ssh via Putty.
Jul 16 14:38:01 askdem CRON[8850]: (root) CMD (echo "test")
Jul 16 14:47:01 askdem CRON[9019]: (root) CMD (/root/MyFunnyEnglishBOT/bot.sh )

And just in case /etc/crontab config
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

And the insides of the script
#!/bin/sh
killall python3;
./sendmessage.py;
screen -d -m ./Bot.py;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2017-07-16
@denistu10

And where did you get the idea that echo in the cron should output to YOUR console?
cron runs tasks in the background, and all stdout is usually redirected to a local email to the user on the localhost.
If you want to see the output of what your cron script displays, write like this:
10 14 * * * /root/MyFunnyEnglishBOT/bot.sh>>/root/MyFunnyEnglishBOT/bot.log
And see what appears in this log file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question