Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 3 down vote accepted

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

share|improve this answer
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


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.