Home > database >  How to launch sh script with crontab?
How to launch sh script with crontab?

Time:08-05

I have sh script that works perfectly if you launch it by yourself. But when I try to put it to the crontab nothing happens. My cron schedule expressions is

21 20 * * * bash a.sh

And this sh script includes

cd /home/ubuntu/currencies_datas_get && python3 AAVEUSDT.py &
cd /home/ubuntu/currencies_datas_get && python3 ADAUSDT.py &
cd /home/ubuntu/currencies_datas_get && python3 APEUSDT.py &
cd /home/ubuntu/currencies_datas_get && python3 ATOMUSDT.py &

It suppose to launch these scripts along and it really works if you try to type bash a.sh to the ubuntu console

CodePudding user response:

Assuming a.sh is in $HOME, make your crontab

21 20 * * * bash $HOME/a.sh

Additionally, depending on where your python3 binary is located, you may need to specify its full path, i.e., /usr/bin/python3 in your script.

CodePudding user response:

I suggest to add full path to python3 in your script.

  • Related