I need to run a specific mysql query upon wget, which is running in the background, finishes downloading a file. For example…
then run:
UPDATE
tableSETstatus= ‘live’ WHEREid= ‘1234’
How would I go about doing this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would recommend launching the wget command in a subshell so you can ensure it completes before you run your mysql command. In bash, this is done with parentheses.
Also use
&&so that the mysql command runs only if the wget command has a success exit status.Putting the password in plaintext in the script is not necessarily a good idea because it can be viewed in a
pslisting.Instead, you can rely on the
[client]section in your~/.my.cnffile. You can also use theMYSQL_PWDenvironment variable. Either of these solutions means there’s no password visible in the command listing.