nerod

Member
Feb 4, 2011
15
0
51
For the first time in years, one of my crons failed. I changed the mysql password yesterday (part of the cron), which seems like it was likely the cause (the error was barking about the characters after & -- which was a character in the password).

Curious why cpanel allows the & symbol to be entered as a character if it has the possibility to break things?


Today is not my day.... happened with ( as well!
 
Last edited:

JaredR.

Well-Known Member
Feb 25, 2010
1,834
24
143
Houston, TX
cPanel Access Level
Root Administrator
The ampersand (&) is used on the Linux command line to separate commands, and that is how it is being interpreted. It is a legal character, but if it is in the middle of the password, everything after the ampersand will be considered to be a new command.

You can try escaping the ampersand by placing a backslash (\) immediately in front of it.

To explain further how the ampersand is treated by the shell (and by cron), consider the following examples:

Code:
# date & w
This tells the shell "Execute the date command and then execute the w command." The following example:

Code:
# date && w
tells the shell "Execute the date command and if and only if it completes successfully, execute the w command. If the first command returns an exit code other than 0, the next command will not be executed.