EVE Milano
EVE Milano

Reputation: 109

Command executes from command line but not from CRON

I'm a beginner I hope you can help me. I have a wordpress development server and I have to change a value in a mysql db every night.

The command I use is the following, and it works via command line.

mysql -u root -pMYPASSWORD MYDB --execute="update DB_options set option_value = 'https://dev.example.com' where option_id = 1"

However, if I use this command in CRONTAB it is not executed and I have no error messages in the log.

40 4 * * * root mysql -u root -pMYPASSWORD MYDB --execute="update DB_options set option_value = 'https://dev.example.com' where option_id = 1"

What am I doing wrong? Thank's for any help, there is so much to learn!

Upvotes: 0

Views: 88

Answers (1)

Romeo Ninov
Romeo Ninov

Reputation: 7265

Om cron the command must be:

40 4 * * * mysql -u root -pMYPASSWORD MYDB --execute="update DB_options set option_value = 'https://dev.example.com' where option_id = 1"

But will be wise to create dedicated shell script with the command and include your profile variables as PATH for example

Upvotes: 1

Related Questions