I have written a bash script that is supposed to be executed by a cron job. But according to the cron output one of the lines in the bash script is not executing.
Here is my bash script
#! /bin/bash
/usr/bin/mysql</home/elijah/Desktop/covid-19-management-tool/cron_job/import.sql
./home/elijah/Desktop/covid-19-management-tool/cron_job/clear
This is the output I got from cron after execution
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
Message-Id: <20210205172001.F3C5FE221D@elijah-HP-255-G6-Notebook-PC>
Date: Fri, 5 Feb 2021 20:20:01 +0300 (EAT)
/home/elijah/Desktop/covid-19-management-tool/cron_job/dbs.sh: line 3: ./home/elijah/Desktop/covid-19-management-tool/cron_job/clear: No such file or directory
--F3C5FE221D.1612545602/elijah-HP-255-G6-Notebook-PC--
For line 3 in my bash script I want to run an executable called clear
.
Someone please tell me how I should do it in the shell script so that cron can understand it.
question from:
https://stackoverflow.com/questions/66068232/what-is-the-right-way-to-write-a-bash-script-for-cron-job 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…