0

I have a MySQL database accessible through CPANEL. I want to execute a SQL command to DELETE from dbtable where eventdate = 'YYYY-MM-DD'. This is my cron job.

curl -L --max-redirs 1000 -v "https://ottawaoc.ca/test/files/delete_dates.sh" 1>/dev/null   

and here is the shell script

#!/bin/bash
mysql --user = "ottawaoc_test" --password = "test ps" --database = "ottawaoc_test" --execute ="DELETE FROM `h8be5_eventregistration` WHERE `eventdate` = '2020-09-27'"

(I do insert the correct password.) I get output mailed to me and it seems to get the shell script but nothing happens within the database.

Could someone help to give me the correct commands and/or tell me how I can get errors from MySQL.

1
  • 2
    That's not how CGI works. Your CGI code needs to return proper headers. Commented Sep 8, 2020 at 21:15

1 Answer 1

1

I used to run mysql crons by putting this in the shell:

#!/bin/bash
echo "mysql statement;" | mysql -B -hHOST -uUSER -pPASS DBNAME
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.