How To Get Cron Job To Pick up ~/.my.cnf
My question is how do I get a cron job to pick up the user's ~/.my.cnf? If the user runs the shell script, everything is fine. The cron entry has the same user run the job, and I've tried #!/bin/bash -l in the shell script with no success.
Here are the details:
I have a bash shell script that launches a Python program.
The python program issues an external shell mysql -e command.
I don't want the python code to use use -u user-name -pMyPassword, db-name, because this is contained in ~/.my.cnf. The python code doesn't have to use these parameters if run interactively, but does have to if run from cron.
I'm trying to find out why.
Thanks in advance for any help.
You should be able to manually set the environment variables that python is checking for in your script before running the python command. It's a bit of a pain to maintain them there as well as in your .bash_profile and/or .bashrc but it works for some scripts I run for starting things like Oracle and Tomcat.
Will try this.
Added export MYSQL_HOME=/home/<user_running_cron>
|All times are GMT -5. The time now is 08:04 AM.|