Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to run the following cronjob and I am getting the following error:

/bin/sh: -c: line 0: syntax error near unexpected token `)'

for the line:

mysqldump --opt -Q -h localhost --user=my_username --password=pass)word db_name | gzip -v9 - > db_backup.sql.gz

How do I properly run this cronjob to prevent issues with characters in the password?

share|improve this question
    
What does the question have to do with ssh? –  tink Oct 29 '12 at 19:21

1 Answer 1

up vote 3 down vote accepted

Put the password in single quotes to avoid sh from processing the string. I.E.

--password='pass)word'
share|improve this answer
1  
Or better yet, put it in a .my.cnf file in the appropriate user's home directory with appropriate ownership and permissions. –  Ladadadada Oct 29 '12 at 19:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.